2.2 FramesOptions (frames.json binding + validator)
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -1,7 +1,10 @@
|
||||
using FrameProcessor.Configuration;
|
||||
using Microsoft.Extensions.Options;
|
||||
|
||||
var builder = WebApplication.CreateBuilder(args);
|
||||
|
||||
builder.Configuration.AddJsonFile("frames.json", optional: false, reloadOnChange: true);
|
||||
|
||||
builder.Services.AddControllers();
|
||||
|
||||
builder.Services.AddOptions<MqttOptions>()
|
||||
@@ -24,6 +27,11 @@ builder.Services.AddOptions<ApiKeyOptions>()
|
||||
.ValidateDataAnnotations()
|
||||
.ValidateOnStart();
|
||||
|
||||
builder.Services.AddSingleton<IValidateOptions<FramesOptions>, FramesOptionsValidator>();
|
||||
builder.Services.AddOptions<FramesOptions>()
|
||||
.Bind(builder.Configuration)
|
||||
.ValidateOnStart();
|
||||
|
||||
var app = builder.Build();
|
||||
|
||||
app.MapControllers();
|
||||
|
||||
Reference in New Issue
Block a user