From bff5e304214e189cca03328e7c6b26b7d342f9e1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sybren=20A=2E=20St=C3=BCvel?= Date: Mon, 4 Apr 2022 16:56:52 +0200 Subject: [PATCH] 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. --- internal/worker/config.go | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/internal/worker/config.go b/internal/worker/config.go index 953b8792..8181f600 100644 --- a/internal/worker/config.go +++ b/internal/worker/config.go @@ -67,16 +67,15 @@ func (fcw *FileConfigWrangler) WorkerConfig() (WorkerConfig, error) { return *fcw.wc, nil } - wc := WorkerConfig{} + wc := fcw.DefaultConfig() err := fcw.loadConfig(configFilename, &wc) if err != nil { if !os.IsNotExist(err) { - return WorkerConfig{}, err + return wc, err } // The config file not existing is fine; just use the defaults. - wc = fcw.DefaultConfig() } fcw.wc = &wc