FileDatabase Improvements

- small bugfixes
 - Startup configuration to load an arbitrary file database for the API
This commit is contained in:
daniel-c-harvey
2025-09-04 14:19:57 -04:00
parent 27522c1e1c
commit c4c4662c67
5 changed files with 52 additions and 6 deletions
+18
View File
@@ -0,0 +1,18 @@
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));
}
}
}