2.1 Configuration POCOs (Mqtt, Storage, UrlFetch, ApiKey)
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -1,7 +1,29 @@
|
||||
using FrameProcessor.Configuration;
|
||||
|
||||
var builder = WebApplication.CreateBuilder(args);
|
||||
|
||||
builder.Services.AddControllers();
|
||||
|
||||
builder.Services.AddOptions<MqttOptions>()
|
||||
.Bind(builder.Configuration.GetSection(MqttOptions.SectionName))
|
||||
.ValidateDataAnnotations()
|
||||
.ValidateOnStart();
|
||||
|
||||
builder.Services.AddOptions<StorageOptions>()
|
||||
.Bind(builder.Configuration.GetSection(StorageOptions.SectionName))
|
||||
.ValidateDataAnnotations()
|
||||
.ValidateOnStart();
|
||||
|
||||
builder.Services.AddOptions<UrlFetchOptions>()
|
||||
.Bind(builder.Configuration.GetSection(UrlFetchOptions.SectionName))
|
||||
.ValidateDataAnnotations()
|
||||
.ValidateOnStart();
|
||||
|
||||
builder.Services.AddOptions<ApiKeyOptions>()
|
||||
.Configure<IConfiguration>((opts, cfg) => opts.Value = cfg[ApiKeyOptions.SectionName] ?? string.Empty)
|
||||
.ValidateDataAnnotations()
|
||||
.ValidateOnStart();
|
||||
|
||||
var app = builder.Build();
|
||||
|
||||
app.MapControllers();
|
||||
|
||||
Reference in New Issue
Block a user