|
|
@@ -1,5 +1,6 @@
|
|
|
using System.Text.Json.Serialization;
|
|
|
using Microsoft.AspNetCore.Components;
|
|
|
+using Microsoft.AspNetCore.DataProtection;
|
|
|
using Microsoft.AspNetCore.Hosting.StaticWebAssets;
|
|
|
using RackPeek.Domain;
|
|
|
using RackPeek.Domain.Git;
|
|
|
@@ -47,6 +48,16 @@ public class Program {
|
|
|
}
|
|
|
}
|
|
|
|
|
|
+ // Persist DataProtection keys next to the config so they live on the
|
|
|
+ // mounted volume: they survive container recreation, and key writes
|
|
|
+ // no longer depend on a writable user profile or /tmp — both of
|
|
|
+ // which are unavailable in hardened Docker setups (#312).
|
|
|
+ var keysPath = Path.Combine(yamlPath, ".dataprotection");
|
|
|
+ Directory.CreateDirectory(keysPath);
|
|
|
+ builder.Services.AddDataProtection()
|
|
|
+ .PersistKeysToFileSystem(new DirectoryInfo(keysPath))
|
|
|
+ .SetApplicationName("RackPeek");
|
|
|
+
|
|
|
builder.Services.ConfigureHttpJsonOptions(options => {
|
|
|
options.SerializerOptions.Converters.Add(
|
|
|
new JsonStringEnumConverter());
|