mirror of
https://github.com/offen/docker-volume-backup.git
synced 2026-04-23 17:05:35 +02:00
Notification level validation should live in resolve method
This commit is contained in:
@@ -240,6 +240,11 @@ func (c *Config) resolve() (reset func() error, warnings []string, err error) {
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if _, ok := hookLevels[c.NotificationLevel]; !ok {
|
||||||
|
err = errwrap.Wrap(nil, fmt.Sprintf("unknown NOTIFICATION_LEVEL %s", c.NotificationLevel))
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
if c.BackupFilenameExpand {
|
if c.BackupFilenameExpand {
|
||||||
c.BackupFilename = os.ExpandEnv(c.BackupFilename)
|
c.BackupFilename = os.ExpandEnv(c.BackupFilename)
|
||||||
c.BackupLatestSymlink = os.ExpandEnv(c.BackupLatestSymlink)
|
c.BackupLatestSymlink = os.ExpandEnv(c.BackupLatestSymlink)
|
||||||
|
|||||||
@@ -78,12 +78,7 @@ func (s *script) init() error {
|
|||||||
return nil
|
return nil
|
||||||
})
|
})
|
||||||
// Register notifications first so they can fire in case of other init errors.
|
// Register notifications first so they can fire in case of other init errors.
|
||||||
|
s.hookLevel = hookLevels[s.c.NotificationLevel]
|
||||||
hookLevel, ok := hookLevels[s.c.NotificationLevel]
|
|
||||||
if !ok {
|
|
||||||
return errwrap.Wrap(nil, fmt.Sprintf("unknown NOTIFICATION_LEVEL %s", s.c.NotificationLevel))
|
|
||||||
}
|
|
||||||
s.hookLevel = hookLevel
|
|
||||||
|
|
||||||
if len(s.c.NotificationURLs) > 0 {
|
if len(s.c.NotificationURLs) > 0 {
|
||||||
sender, senderErr := shoutrrr.CreateSender(s.c.NotificationURLs...)
|
sender, senderErr := shoutrrr.CreateSender(s.c.NotificationURLs...)
|
||||||
|
|||||||
Reference in New Issue
Block a user