summaryrefslogtreecommitdiff
path: root/Program.cs
diff options
context:
space:
mode:
Diffstat (limited to 'Program.cs')
-rw-r--r--Program.cs8
1 files changed, 8 insertions, 0 deletions
diff --git a/Program.cs b/Program.cs
index e7f1e26..548f6e9 100644
--- a/Program.cs
+++ b/Program.cs
@@ -2,6 +2,7 @@ using Microsoft.EntityFrameworkCore;
using System.Text.Json.Serialization;
using HyperBooru.Services;
using Microsoft.AspNetCore.Authentication.Cookies;
+using Microsoft.AspNetCore.DataProtection;
namespace HyperBooru;
@@ -30,6 +31,13 @@ public class Program {
builder.Services.AddHostedService<OcrService>();
builder.Services.AddSingleton<ISourceService, SourceService>();
+ // Ensure session keys are stored in a persistent location on all platforms
+ builder.Services.AddDataProtection()
+ .PersistKeysToFileSystem(new(
+ builder.Services.BuildServiceProvider()
+ .GetRequiredService<IConfigService>()
+ .KeyPath));
+
var app = builder.Build();
// Ensure database is created and it's schema is up to date