Content API Upgrades

This commit is contained in:
daniel-c-harvey
2025-09-04 19:58:29 -04:00
parent 9de2063ea3
commit 1a9a3271d4
14 changed files with 394 additions and 65 deletions
+12
View File
@@ -1,11 +1,22 @@
using DeepDrftContent;
using DeepDrftContent.FileDatabase.Services;
using DeepDrftContent.Middleware;
using DeepDrftContent.Models;
var builder = WebApplication.CreateBuilder(args);
// Add services to the container.
await Startup.ConfigureDomainServices(builder);
builder.Services.AddControllers();
// Learn more about configuring OpenAPI at https://aka.ms/aspnet/openapi
builder.Services.AddOpenApi();
// Load API key configuration
builder.Configuration.AddJsonFile("environment/apikey.json", optional: false, reloadOnChange: true);
var apiKeySettings = builder.Configuration.GetSection(nameof(ApiKeySettings)).Get<ApiKeySettings>();
if (apiKeySettings is null) { throw new Exception("API key settings are not configured"); }
var app = builder.Build();
// Configure the HTTP request pipeline.
@@ -14,6 +25,7 @@ if (app.Environment.IsDevelopment())
app.MapOpenApi();
}
app.UseApiKeyAuthentication(apiKeySettings.ApiKey);
app.UseAuthorization();
app.MapControllers();