Sanity check the watch interval

This commit is contained in:
Justin Hawkins 2021-10-10 12:51:15 +10:30
parent 3e6cf49394
commit 90f8c3588b

View File

@ -149,6 +149,10 @@ func (c *ConfigService) Save() error {
}
}
if c.Config.WatchInterval < 1 {
return fmt.Errorf("watch interval should be greater than 0 - '%d' invalid", c.Config.WatchInterval)
}
jsonString, _ := json.Marshal(c.Config)
err := ioutil.WriteFile(c.ConfigFilename, jsonString, os.ModePerm)
if err != nil {