From e3fbcaeb729f5dd02f4b7c96c10b952c1d7dfe2a Mon Sep 17 00:00:00 2001 From: Harshavardhana Date: Sat, 9 Sep 2023 08:53:32 -0700 Subject: [PATCH] allow scanner key cycle to be empty (#18001) configs from 2020 server throws an error due to deprecation of the keys however an attempt is made to parse them, we should have chosen existing defaults - this PR fixes that. --- internal/config/scanner/scanner.go | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/internal/config/scanner/scanner.go b/internal/config/scanner/scanner.go index ecf733a59..77da20675 100644 --- a/internal/config/scanner/scanner.go +++ b/internal/config/scanner/scanner.go @@ -127,7 +127,11 @@ func lookupDeprecatedScannerConfig(kvs config.KVS) (cfg Config, err error) { if err != nil { return cfg, err } - cfg.Cycle, err = time.ParseDuration(env.Get(EnvCycle, kvs.GetWithDefault(Cycle, DefaultKVS))) + cycle := env.Get(EnvCycle, kvs.GetWithDefault(Cycle, DefaultKVS)) + if cycle == "" { + cycle = "1m" + } + cfg.Cycle, err = time.ParseDuration(cycle) if err != nil { return cfg, err }