fix(card-master): wire EnableServing kill switch in controller + add to config-section test
This commit is contained in:
@@ -1,4 +1,6 @@
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using SVSim.Database.Models.Config;
|
||||
using SVSim.Database.Services;
|
||||
using SVSim.EmulatedEntrypoint.Models.Dtos.Requests.ImmutableData;
|
||||
using SVSim.EmulatedEntrypoint.Models.Dtos.Responses.ImmutableData;
|
||||
using SVSim.EmulatedEntrypoint.Services;
|
||||
@@ -13,10 +15,12 @@ namespace SVSim.EmulatedEntrypoint.Controllers;
|
||||
public class ImmutableDataController : SVSimController
|
||||
{
|
||||
private readonly ICardMasterPayloadProvider _provider;
|
||||
private readonly IGameConfigService _config;
|
||||
|
||||
public ImmutableDataController(ICardMasterPayloadProvider provider)
|
||||
public ImmutableDataController(ICardMasterPayloadProvider provider, IGameConfigService config)
|
||||
{
|
||||
_provider = provider;
|
||||
_config = config;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -32,6 +36,11 @@ public class ImmutableDataController : SVSimController
|
||||
// 500 not 503: blob missing is operator error (config / build), not transient — no retry will help.
|
||||
return StatusCode(500, "card-master payload not available");
|
||||
}
|
||||
if (!_config.Get<CardMasterConfig>().EnableServing)
|
||||
{
|
||||
// 503: explicit operator kill switch — temporarily disabled, distinct from 500 (misconfig).
|
||||
return StatusCode(503, "card-master serving disabled");
|
||||
}
|
||||
return Ok(new CardMasterResponse { CardMaster = _provider.Base64Blob });
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user