From fcc502edcf4fa4d6e2343585916a0c61881e47e2 Mon Sep 17 00:00:00 2001 From: "Berengar W. Lehr" Date: Thu, 28 Sep 2023 11:01:37 +0200 Subject: [PATCH] Only update config if config file is actually used --- pkg/config/config.go | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/pkg/config/config.go b/pkg/config/config.go index 860cad5e0..57f7bef8f 100644 --- a/pkg/config/config.go +++ b/pkg/config/config.go @@ -419,7 +419,6 @@ func InitConfig() { viper.SetConfigName("config") err = viper.ReadInConfig() - log.ConfigLogger(LogEnabled.GetBool(), LogStandard.GetString(), LogPath.GetString(), LogLevel.GetString()) if viper.ConfigFileUsed() != "" { log.Infof("Using config file: %s", viper.ConfigFileUsed()) @@ -427,6 +426,8 @@ func InitConfig() { if err != nil { log.Warning(err.Error()) log.Warning("Using default config.") + } else { + log.ConfigLogger(LogEnabled.GetBool(), LogStandard.GetString(), LogPath.GetString(), LogLevel.GetString()) } } else { log.Info("No config file found, using default or config from environment variables.")