feat(settings): sections visuelles IA/Notifications/Défauts agents — suppression du CRUD clé/valeur (Fixes #79)

- SettingsPage refondue : plus de création/édition clé/valeur arbitraire,
  chaque domaine a sa section dédiée (pattern StorageSettingsSection)
- NotificationSettingsSection : ntfy (baseUrl, token) + email SMTP (from,
  host, port, user, password, SSL) — secrets masqués, redaction API respectée
- AiSettingsSection : URLs CodeProject.AI/Ollama + toggle détection IA
- AgentDefaultsSection : niveau de log global (select), rétention logs,
  intervalle heartbeat, DSN Sentry
- Seed #80 étendu : ai.detection.enabled, log.level, log.retentionDays,
  heartbeat.interval.seconds, sentry.dsn (idempotent, catégories cohérentes)
- Tests bUnit : 12 tests (4 page + 8 sections) — rendu, PUT par clé, secrets
  redactés invisibles ; 221 tests Web verts
This commit is contained in:
Arnaud Dartois committed 2026-08-12 10:46:09 +02:00
1 parent a07a0cae52
commit d527f3ccc9
9 files changed
+648 -758

No files matched your search

+13 -1
View File
@@ -254,13 +254,20 @@ public partial class Program {
["email.useSsl"] = Environment.GetEnvironmentVariable("EMAIL__USE_SSL") ?? "true",
["ai.cpaiUrl"] = Environment.GetEnvironmentVariable("CPAI_URL"),
["ai.ollamaUrl"] = Environment.GetEnvironmentVariable("OLLAMA_URL"),
["ai.detection.enabled"] = Environment.GetEnvironmentVariable("AI__DETECTION__ENABLED") ?? "true",
["log.level"] = Environment.GetEnvironmentVariable("LOG__LEVEL") ?? "info",
["log.retentionDays"] = Environment.GetEnvironmentVariable("LOG__RETENTION_DAYS") ?? "7",
["heartbeat.interval.seconds"] = Environment.GetEnvironmentVariable("HEARTBEAT__INTERVAL_SECONDS") ?? "30",
["sentry.dsn"] = Environment.GetEnvironmentVariable("SENTRY_DSN"),
};
foreach (var (key, value) in integrationDefaults)
{
if (await groupDb.AppSettings.AnyAsync(s => s.Key == key))
continue;
groupDb.AppSettings.Add(new Heimdall.Domain.Entities.AppSetting(
key, value ?? string.Empty, "integrations",
key, value ?? string.Empty,
key.StartsWith("ntfy.", StringComparison.Ordinal) || key.StartsWith("email.", StringComparison.Ordinal)
? "integrations" : key.StartsWith("ai.", StringComparison.Ordinal) ? "ai" : "agent",
key switch
{
"ntfy.baseUrl" => "Serveur ntfy (URL de base)",
@@ -274,6 +281,11 @@ public partial class Program {
"email.useSsl" => "Utiliser SSL/TLS pour SMTP",
"ai.cpaiUrl" => "URL CodeProject.AI",
"ai.ollamaUrl" => "URL Ollama",
"ai.detection.enabled" => "Détection IA activée par défaut",
"log.level" => "Niveau de log global (agents + central)",
"log.retentionDays" => "Rétention des logs agents (jours)",
"heartbeat.interval.seconds" => "Intervalle de heartbeat des agents (secondes)",
"sentry.dsn" => "DSN Sentry/GlitchTip (diagnostic)",
_ => key
}));
}