diff options
| author | Leitwolf | 2026-10-07 07:09:39 +0300 |
|---|---|---|
| committer | GitHub | 2026-10-07 07:09:39 +0300 |
| commit | 111a6175e0a92808ddc2a47088fa9858001eeed9 (patch) | |
| tree | 0668bcb5fb3f52c92e94e40280228bad546a7511 /apps/api/Program.cs | |
| parent | 5d4a9699675c0c0b9cd84c67f423e6e0f836a5d1 (diff) | |
| parent | a1383b688d3d2159e3ba525682180f9d5a4a2c80 (diff) | |
| download | progmaweb-111a6175e0a92808ddc2a47088fa9858001eeed9.tar.gz | |
Merge pull request #28 from Progmasoft/feature/durable-account-store
Keep accounts and sessions in PostgreSQL
Diffstat (limited to 'apps/api/Program.cs')
| -rw-r--r-- | apps/api/Program.cs | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/apps/api/Program.cs b/apps/api/Program.cs index b5c8708..fd6e97b 100644 --- a/apps/api/Program.cs +++ b/apps/api/Program.cs @@ -13,7 +13,9 @@ WebApplicationBuilder builder = WebApplication.CreateBuilder(args); builder.Services.Configure<AccountSessionOptions>(builder.Configuration.GetSection(AccountSessionOptions.SectionName)); builder.Services.AddSingleton(TimeProvider.System); -builder.Services.AddSingleton<IAccountStore, InMemoryAccountStore>(); +AccountStoreKind accountStore = builder.Services.AddAccountStore( + builder.Configuration, + builder.Environment.IsProduction()); builder.Services.AddSingleton<AccountService>(); builder.Services.AddSingleton<SessionService>(); AuthenticationBuilder authentication = builder.Services @@ -69,6 +71,11 @@ builder.WebHost.ConfigureKestrel(options => options.Limits.MaxRequestBodySize = WebApplication app = builder.Build(); +if (accountStore is AccountStoreKind.Memory) +{ + AccountStoreRegistration.WarnThatAccountsAreInMemory(app.Logger); +} + app.UseForwardedHeaders(); if (!app.Environment.IsDevelopment()) { |