Worker: use defaults for partial configuration

Instead of having a full "defaults OR the loaded config" (where a partial
config file would thus have the nil value for missing properties) the
missing properties now retain their default value.
This commit is contained in:
Sybren A. Stüvel 2022-04-04 16:56:52 +02:00
parent 0f2477370f
commit bff5e30421

View File

@ -67,16 +67,15 @@ func (fcw *FileConfigWrangler) WorkerConfig() (WorkerConfig, error) {
return *fcw.wc, nil return *fcw.wc, nil
} }
wc := WorkerConfig{} wc := fcw.DefaultConfig()
err := fcw.loadConfig(configFilename, &wc) err := fcw.loadConfig(configFilename, &wc)
if err != nil { if err != nil {
if !os.IsNotExist(err) { if !os.IsNotExist(err) {
return WorkerConfig{}, err return wc, err
} }
// The config file not existing is fine; just use the defaults. // The config file not existing is fine; just use the defaults.
wc = fcw.DefaultConfig()
} }
fcw.wc = &wc fcw.wc = &wc