fix(agent): align failover with heartbeat intervals
Heimdall Gitea / Build and tests (pull_request) Canceled after 0s
Heimdall Gitea / Build and scan server image (pull_request) Canceled after 0s
Heimdall Gitea / Build and scan agent image (pull_request) Canceled after 0s
Heimdall Gitea / Publish Docker Hub latest tags (pull_request) Canceled after 0s
Heimdall Gitea / Publish versioned release (pull_request) Canceled after 0s
Heimdall Gitea / Build and tests (pull_request) Canceled after 0s
Heimdall Gitea / Build and scan server image (pull_request) Canceled after 0s
Heimdall Gitea / Build and scan agent image (pull_request) Canceled after 0s
Heimdall Gitea / Publish Docker Hub latest tags (pull_request) Canceled after 0s
Heimdall Gitea / Publish versioned release (pull_request) Canceled after 0s
This commit is contained in:
1 parent
83ee648c2d
commit
8d5447f826
10 files changed
+125
-23
No files matched your search
@@ -296,6 +296,10 @@ public partial class Program
|
||||
|
||||
private static async Task SeedIntegrationSettingsAsync(AppDbContext groupDb, HashSet<string> existingKeys)
|
||||
{
|
||||
var heartbeatInterval = Environment.GetEnvironmentVariable("HEARTBEAT__INTERVAL_SECONDS");
|
||||
if (!int.TryParse(heartbeatInterval, out var heartbeatSeconds) || heartbeatSeconds is < 5 or > 300)
|
||||
heartbeatInterval = "30";
|
||||
|
||||
var defaults = new Dictionary<string, string?>
|
||||
{
|
||||
["ntfy.baseUrl"] = Environment.GetEnvironmentVariable("NTFY__BASE_URL") ?? "https://ntfy.sh",
|
||||
@@ -312,9 +316,17 @@ public partial class Program
|
||||
["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",
|
||||
["heartbeat.interval.seconds"] = heartbeatInterval,
|
||||
["sentry.enabled"] = "true",
|
||||
};
|
||||
|
||||
var existingHeartbeatSetting = await groupDb.AppSettings
|
||||
.FirstOrDefaultAsync(setting => setting.Key == "heartbeat.interval.seconds");
|
||||
if (existingHeartbeatSetting is not null &&
|
||||
(!int.TryParse(existingHeartbeatSetting.Value, out var storedHeartbeatSeconds) ||
|
||||
storedHeartbeatSeconds is < 5 or > 300))
|
||||
existingHeartbeatSetting.UpdateValue(heartbeatInterval);
|
||||
|
||||
foreach (var (key, value) in defaults)
|
||||
{
|
||||
if (existingKeys.Contains(key)) continue;
|
||||
|
||||
Reference in new issue
Block a user