Files
deepdrft/DeepDrftContent/Startup.cs
T
daniel-c-harvey c4c4662c67 FileDatabase Improvements
- small bugfixes
 - Startup configuration to load an arbitrary file database for the API
2025-09-04 14:19:57 -04:00

18 lines
768 B
C#

using DeepDrftContent.Models;
namespace DeepDrftContent
{
public static class Startup
{
public static void ConfigureDomainServices(WebApplicationBuilder builder)
{
// File Database
builder.Configuration.AddJsonFile("environment/filedatabase.json", optional: false, reloadOnChange: true);
var fileDatabaseSettings = builder.Configuration.GetSection(nameof(FileDatabaseSettings)).Get<FileDatabaseSettings>();
if (fileDatabaseSettings is null) { throw new Exception("File database settings are not configured"); }
builder.Services.AddSingleton(
FileDatabase.Services.FileDatabase.FromAsync(
fileDatabaseSettings.VaultPath));
}
}
}