Only update config if config file is actually used

This commit is contained in:
Berengar W. Lehr 2023-09-28 11:01:37 +02:00
parent e5ebc6ede6
commit fcc502edcf
1 changed files with 2 additions and 1 deletions

View File

@ -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.")