- Added `SchedulerWorkerOptions` class to encapsulate configuration for the scheduler worker. - Introduced `PlannerBackgroundService` to manage the planner loop, fetching and processing planning runs. - Created `PlannerExecutionService` to handle the execution logic for planning runs, including impact targeting and run persistence. - Developed `PlannerExecutionResult` and `PlannerExecutionStatus` to standardize execution outcomes. - Implemented validation logic within `SchedulerWorkerOptions` to ensure proper configuration. - Added documentation for the planner loop and impact targeting features. - Established health check endpoints and authentication mechanisms for the Signals service. - Created unit tests for the Signals API to ensure proper functionality and response handling. - Configured options for authority integration and fallback authentication methods.
40 lines
1.4 KiB
C#
40 lines
1.4 KiB
C#
using StellaOps.Cartographer.Options;
|
|
|
|
var builder = WebApplication.CreateBuilder(args);
|
|
|
|
builder.Configuration
|
|
.AddJsonFile("appsettings.json", optional: true, reloadOnChange: true)
|
|
.AddEnvironmentVariables("CARTOGRAPHER_");
|
|
|
|
builder.Services.AddOptions();
|
|
builder.Services.AddLogging();
|
|
|
|
var authoritySection = builder.Configuration.GetSection("Cartographer:Authority");
|
|
var authorityOptions = new CartographerAuthorityOptions();
|
|
authoritySection.Bind(authorityOptions);
|
|
CartographerAuthorityOptionsConfigurator.ApplyDefaults(authorityOptions);
|
|
authorityOptions.Validate();
|
|
|
|
builder.Services.AddSingleton(authorityOptions);
|
|
builder.Services.AddOptions<CartographerAuthorityOptions>()
|
|
.Bind(authoritySection)
|
|
.PostConfigure(CartographerAuthorityOptionsConfigurator.ApplyDefaults);
|
|
|
|
// TODO: register Cartographer graph builders, overlay workers, and Authority client once implementations land.
|
|
|
|
var app = builder.Build();
|
|
|
|
if (!authorityOptions.Enabled)
|
|
{
|
|
app.Logger.LogWarning("Cartographer Authority authentication is disabled; enable it before production deployments.");
|
|
}
|
|
else if (authorityOptions.AllowAnonymousFallback)
|
|
{
|
|
app.Logger.LogWarning("Cartographer Authority allows anonymous fallback; disable fallback before production rollout.");
|
|
}
|
|
|
|
app.MapGet("/healthz", () => Results.Ok(new { status = "ok" }));
|
|
app.MapGet("/readyz", () => Results.Ok(new { status = "warming" }));
|
|
|
|
app.Run();
|