using Microsoft.Extensions.Configuration; using Microsoft.Extensions.DependencyInjection; using Microsoft.Extensions.Logging; using StellaOps.AirGap.Controller.Options; using StellaOps.AirGap.Controller.Services; using StellaOps.AirGap.Controller.Stores; using StellaOps.AirGap.Importer.Validation; using StellaOps.AirGap.Time.Services; namespace StellaOps.AirGap.Controller.DependencyInjection; public static class AirGapControllerServiceCollectionExtensions { public static IServiceCollection AddAirGapController(this IServiceCollection services, IConfiguration configuration) { services.Configure(configuration.GetSection("AirGap:Startup")); services.Configure(configuration.GetSection("AirGap:Telemetry")); services.AddSingleton(); services.AddSingleton(); services.AddSingleton(); services.AddSingleton(); services.AddSingleton(); services.AddSingleton(); services.AddSingleton(); services.AddSingleton(sp => { var logger = sp.GetRequiredService>(); logger.LogWarning("AirGap controller using in-memory state store; state resets on process restart."); return new InMemoryAirGapStateStore(); }); services.AddHostedService(); return services; } }