feat(settings): topic ntfy par site, SMTP/ntfy/S3 globaux, DSN GlitchTip fixe + toggle (Fixes #105 #106 #107 #108)
#105 — Topic ntfy cible par site : - Site.NtfyTopic (migration AddSiteNtfyTopic), UI création/édition SitesPage - NotificationService.ResolveNtfyTopicAsync : topic du site sinon heimdall_{userId} #106 — Paramètres SMTP/ntfy/S3 GLOBAUX : - Seed + sections UI : agentScoped=false pour ntfy.*/email.*/storage.*/sentry.* - Migration douce au démarrage : UPDATE des clés existantes en base #107 — GlitchTip : DSN fixes (central projet 6, agent projet 7) dans appsettings, - plus de champ DSN éditable en UI → switch sentry.enabled (nécessite redémarrage) - Init Sentry déplacé après AddInfrastructure, lit sentry.enabled en base (fallback true) #108 — Composants typés : MudNumericField borné (port SMTP, rétention, heartbeat), - switch pour booléens, select pour log.level — pas de saisie libre
This commit is contained in:
1 parent
85bfdac7ee
commit
dc8a24918d
25 files changed
+2485
-153
No files matched your search
@@ -31,11 +31,10 @@
|
||||
</MudSelect>
|
||||
</MudItem>
|
||||
<MudItem xs="12" md="6">
|
||||
<MudTextField T="string" Label="Rétention des logs agents (jours)" Variant="Variant.Outlined"
|
||||
Type="InputType.Number"
|
||||
Value="@GetValue("log.retentiondays")"
|
||||
ValueChanged="OnRetentionChanged"
|
||||
HelperText="Durée de conservation des logs remontés par les agents." />
|
||||
<MudNumericField T="int?" Label="Rétention des logs agents (jours)" Variant="Variant.Outlined"
|
||||
Value="@(int.TryParse(GetValue("log.retentiondays"), out var r) ? r : null)"
|
||||
ValueChanged="OnRetentionChanged" Min="1" Max="3650"
|
||||
HelperText="Durée de conservation des logs remontés par les agents." />
|
||||
</MudItem>
|
||||
</MudGrid>
|
||||
|
||||
@@ -44,11 +43,10 @@
|
||||
</MudText>
|
||||
<MudGrid>
|
||||
<MudItem xs="12" md="6">
|
||||
<MudTextField T="string" Label="Intervalle de heartbeat (secondes)" Variant="Variant.Outlined"
|
||||
Type="InputType.Number"
|
||||
Value="@GetValue("heartbeat.interval.seconds")"
|
||||
ValueChanged="OnHeartbeatChanged"
|
||||
HelperText="Fréquence de la remontée d'état des agents vers le central." />
|
||||
<MudNumericField T="int?" Label="Intervalle de heartbeat (secondes)" Variant="Variant.Outlined"
|
||||
Value="@(int.TryParse(GetValue("heartbeat.interval.seconds"), out var h) ? h : null)"
|
||||
ValueChanged="OnHeartbeatChanged" Min="5" Max="3600"
|
||||
HelperText="Fréquence de la remontée d'état des agents vers le central." />
|
||||
</MudItem>
|
||||
</MudGrid>
|
||||
|
||||
@@ -56,13 +54,13 @@
|
||||
<i class="fas fa-bug mr-1" style="color: var(--mud-palette-primary);"></i> Diagnostic
|
||||
</MudText>
|
||||
<MudGrid>
|
||||
<MudItem xs="12" md="6">
|
||||
<MudTextField T="string" Label="DSN Sentry / GlitchTip" Variant="Variant.Outlined"
|
||||
Type="InputType.Password"
|
||||
Value="@SecretValue("sentry.dsn")"
|
||||
ValueChanged="OnSentryDsnChanged"
|
||||
Placeholder="•••••••• (déjà configuré)"
|
||||
HelperText="Endpoint de remontée d'erreurs. Nécessite un redémarrage pour être pris en compte." />
|
||||
<MudItem xs="12">
|
||||
<MudSwitch T="bool"
|
||||
Value="@(GetValue("sentry.enabled")?.Equals("true", StringComparison.OrdinalIgnoreCase) == true)"
|
||||
ValueChanged="OnSentryEnabledChanged"
|
||||
Color="Color.Primary"
|
||||
Label="Envoyer les erreurs vers GlitchTip"
|
||||
HelperText="Le DSN est fixe (configuré par l'application). Nécessite un redémarrage pour être pris en compte." />
|
||||
</MudItem>
|
||||
</MudGrid>
|
||||
</MudPaper>
|
||||
@@ -85,16 +83,10 @@
|
||||
private string? GetValue(string key)
|
||||
=> _settings.FirstOrDefault(s => s.Key == key)?.Value;
|
||||
|
||||
private string SecretValue(string key)
|
||||
{
|
||||
var v = GetValue(key);
|
||||
return v is null or "" or "***REDACTED***" ? string.Empty : v;
|
||||
}
|
||||
|
||||
private Task OnLogLevelChanged(string v) => SaveValueAsync("log.level", v);
|
||||
private Task OnRetentionChanged(string v) => SaveValueAsync("log.retentiondays", v);
|
||||
private Task OnHeartbeatChanged(string v) => SaveValueAsync("heartbeat.interval.seconds", v);
|
||||
private Task OnSentryDsnChanged(string v) => SaveValueAsync("sentry.dsn", v);
|
||||
private Task OnRetentionChanged(int? v) => SaveValueAsync("log.retentiondays", v?.ToString() ?? "");
|
||||
private Task OnHeartbeatChanged(int? v) => SaveValueAsync("heartbeat.interval.seconds", v?.ToString() ?? "");
|
||||
private Task OnSentryEnabledChanged(bool v) => SaveValueAsync("sentry.enabled", v ? "true" : "false");
|
||||
|
||||
private async Task SaveValueAsync(string key, string? value)
|
||||
{
|
||||
|
||||
@@ -56,10 +56,9 @@
|
||||
HelperText="Ex : smtp.gmail.com" />
|
||||
</MudItem>
|
||||
<MudItem xs="6" md="2">
|
||||
<MudTextField T="string" Label="Port SMTP" Variant="Variant.Outlined"
|
||||
Type="InputType.Number"
|
||||
Value="@GetValue("email.smtpport")"
|
||||
ValueChanged="OnSmtpPortChanged" />
|
||||
<MudNumericField T="int?" Label="Port SMTP" Variant="Variant.Outlined"
|
||||
Value="@(int.TryParse(GetValue("email.smtpport"), out var p) ? p : null)"
|
||||
ValueChanged="OnSmtpPortChanged" Min="1" Max="65535" />
|
||||
</MudItem>
|
||||
<MudItem xs="12" md="3">
|
||||
<MudTextField T="string" Label="Utilisateur SMTP" Variant="Variant.Outlined"
|
||||
@@ -135,7 +134,7 @@
|
||||
private Task OnFromAddressChanged(string v) => SaveValueAsync("email.fromaddress", v);
|
||||
private Task OnFromNameChanged(string v) => SaveValueAsync("email.fromname", v);
|
||||
private Task OnSmtpHostChanged(string v) => SaveValueAsync("email.smtphost", v);
|
||||
private Task OnSmtpPortChanged(string v) => SaveValueAsync("email.smtpport", v);
|
||||
private Task OnSmtpPortChanged(int? v) => SaveValueAsync("email.smtpport", v?.ToString() ?? "");
|
||||
private Task OnUsernameChanged(string v) => SaveValueAsync("email.username", v);
|
||||
private Task OnPasswordChanged(string v) => SaveValueAsync("email.password", v);
|
||||
private Task OnUseSslChanged(bool v) => SaveValueAsync("email.usessl", v ? "true" : "false");
|
||||
@@ -187,7 +186,7 @@
|
||||
await Api.CreateSettingAsync(new CreateAppSettingRequest(
|
||||
Key: key, Value: value,
|
||||
Category: "integrations",
|
||||
Description: key, ValueType: "string", AllowedValues: null, AgentScoped: true));
|
||||
Description: key, ValueType: "string", AllowedValues: null, AgentScoped: false));
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
@@ -125,7 +125,7 @@
|
||||
Key: key, Value: value, Category: "storage",
|
||||
Description: key.StartsWith("storage.s3.secretKey", StringComparison.Ordinal)
|
||||
? "Clé secrète S3" : key,
|
||||
ValueType: "string", AllowedValues: null, AgentScoped: true));
|
||||
ValueType: "string", AllowedValues: null, AgentScoped: false));
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
Reference in new issue
Block a user