feature: In-App Simulation Runner (Backend)
CI / frontend (push) Canceled after 0s
CI / backend (push) Canceled after 8m32s

This commit is contained in:
voltsrage
2026-08-06 01:52:53 +08:00
parent 943d41339c
commit 24f45851e9
83 changed files with 3974 additions and 120 deletions
@@ -0,0 +1,26 @@
using Microsoft.Extensions.Options;
using VigilCare.Simulation;
public sealed class SimulationClientFactory : ISimulationClientFactory
{
private readonly IHttpClientFactory _http;
private readonly SimulationOptions _options;
public SimulationClientFactory(IHttpClientFactory http, IOptions<SimulationOptions> options)
{
_http = http;
_options = options.Value;
}
public async Task<VigilCareApiClient> CreateAsync(CancellationToken ct = default)
{
if (string.IsNullOrWhiteSpace(_options.RunnerPassword))
throw new InvalidOperationException(
"Simulation:RunnerPassword is required when Simulation:Enabled is true.");
var http = _http.CreateClient("simulation-loopback");
var client = new VigilCareApiClient(http);
await client.LoginAsync(_options.RunnerUsername, _options.RunnerPassword);
return client;
}
}