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.
This commit is contained in:
Harshavardhana 2023-09-09 08:53:32 -07:00 committed by GitHub
parent ca6dd8be5e
commit e3fbcaeb72
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -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
}