fix: resolve demo admin seeding, Sentry DSN pass-through, and add startup diagnostics

- Replace IsDevelopment() guard with Seed:DemoOnStartup config flag
  (default: true, disable via SEED__DEMO_ON_STARTUP=false)
- Add Seed:AdminLogin (env SEED__ADMIN_LOGIN) to customize demo admin email
- Add Seed:AdminDisplayName (env SEED__ADMIN_DISPLAYNAME) to customize display name
- Add Sentry__Dsn env var to docker-compose files (matches .env convention)
- Increase Heimdall log level to Debug for startup diagnostics
- Add [DIAG] startup logs for Sentry DSN, Data Protection keys, environment
- Add Data Protection key directory diagnostic in DependencyInjection
This commit is contained in:
Arnaud Dartois committed 2026-07-29 14:21:16 +00:00
1 parent 100e230af5
commit afc1b2e032
7 files changed
+579 -7

No files matched your search

@@ -62,6 +62,7 @@ public static class DependencyInjection
// Tests: use ephemeral keys (no persistence, no certificate encryption)
services.AddDataProtection()
.SetApplicationName("Heimdall");
Console.WriteLine("[DIAG] Data Protection: mode=Ephemeral (no key persistence)");
}
else
{
@@ -94,10 +95,12 @@ public static class DependencyInjection
DateTimeOffset.UtcNow.AddDays(-1),
DateTimeOffset.UtcNow.AddYears(10));
File.WriteAllBytes(certFile.FullName, cert.Export(X509ContentType.Pfx, ""));
Console.WriteLine($"[DIAG] Data Protection: new self-signed cert generated at {certFile.FullName}");
}
#pragma warning disable SYSLIB0057 // X509Certificate2(string, string) is obsolete — X509CertificateLoader not available in this SDK
var dpCert = new X509Certificate2(certFile.FullName, "");
Console.WriteLine($"[DIAG] Data Protection: mode=Persisted, keys dir={dpDir.FullName}, cert exists={certFile.Exists}");
#pragma warning restore SYSLIB0057
dpBuilder.ProtectKeysWithCertificate(dpCert);
}