Add Unraid and Gotify notifications

This commit is contained in:
Mikei386
2026-06-14 13:50:02 +02:00
parent b7fe6ac86f
commit 1af23831f4
15 changed files with 232 additions and 44 deletions
+20 -1
View File
@@ -155,7 +155,7 @@ func DefaultConfig() Config {
SchemaVersion: SchemaVersion,
Jobs: []Job{},
Repositories: []Repository{},
Notifications: []NotificationTarget{},
Notifications: []NotificationTarget{{SchemaVersion: SchemaVersion, ID: "unraid", Name: "Unraid", Type: "unraid", Enabled: true, Events: []string{"success", "warning", "failed"}}},
Settings: Settings{
ResticPath: "/usr/local/libexec/backupper/restic",
RestoreRoot: "/mnt/user/backupper-restores",
@@ -165,3 +165,22 @@ func DefaultConfig() Config {
},
}
}
func NormalizeConfig(c Config) Config {
notifications := make([]NotificationTarget, 0, len(c.Notifications)+1)
hasUnraid := false
for _, target := range c.Notifications {
if target.Type == "ntfy" {
continue
}
if target.Type == "unraid" {
hasUnraid = true
}
notifications = append(notifications, target)
}
if !hasUnraid {
notifications = append(notifications, NotificationTarget{SchemaVersion: SchemaVersion, ID: "unraid", Name: "Unraid", Type: "unraid", Enabled: true, Events: []string{"success", "warning", "failed"}})
}
c.Notifications = notifications
return c
}