Add Unraid and Gotify notifications
This commit is contained in:
+20
-1
@@ -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
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user