From 90f8c3588bdfa9b9d0d276ba9f8185be458dc9fd Mon Sep 17 00:00:00 2001 From: Justin Hawkins Date: Sun, 10 Oct 2021 12:51:15 +1030 Subject: [PATCH] Sanity check the watch interval --- config/config.go | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/config/config.go b/config/config.go index 03bfc17..e986960 100644 --- a/config/config.go +++ b/config/config.go @@ -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 {