From e2cbea77c0a03fd7121e2e72ae19b58f96848547 Mon Sep 17 00:00:00 2001 From: edutomesco Date: Thu, 23 May 2024 16:00:20 +0100 Subject: [PATCH] =?UTF-8?q?master=20|=C2=A0do=20not=20return=20error=20whe?= =?UTF-8?q?n=20just=20do=20not=20have=20config=20file?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- internal/config/config.go | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/internal/config/config.go b/internal/config/config.go index 0745437..9021f60 100644 --- a/internal/config/config.go +++ b/internal/config/config.go @@ -96,11 +96,10 @@ func InitConfig() (*Config, error) { if err != nil { switch err.(type) { default: - log.Println("Enter 0") return nil, fmt.Errorf("fatal error loading config file: %s", err) case viper.ConfigFileNotFoundError: - log.Println("Enter 1") - return nil, errors.New("No config file found. Using defaults and environment variables") + log.Println("No config file found. Using defaults and environment variables") + return nil, nil } } @@ -108,7 +107,6 @@ func InitConfig() (*Config, error) { err = viper.Unmarshal(&Configuration) if err != nil { - log.Println("Enter 2") return nil, fmt.Errorf("fatal error loading config file: %s", err) } defaults.SetDefaults(&Configuration) @@ -117,7 +115,6 @@ func InitConfig() (*Config, error) { if Configuration.Integrity.AggregateMode { if Configuration.Bloock.ApiKey == "" { - log.Println("Enter 3") return nil, errors.New("aggregate mode requires a BLOOCK Api Key set") } }