fix(config): log reload message once (#1773)

fix(config): prevent double logging of config reload message
This commit is contained in:
soup 2024-10-20 12:56:42 +02:00 committed by GitHub
parent 04ffb0b39d
commit 2386a9db31
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -387,8 +387,10 @@ func (c *AppConfig) load(configPath string) {
}
func (c *AppConfig) DynamicReload(log logger.Logger) {
viper.WatchConfig()
viper.OnConfigChange(func(e fsnotify.Event) {
c.m.Lock()
defer c.m.Unlock()
logLevel := viper.GetString("logLevel")
c.Config.LogLevel = logLevel
@ -401,10 +403,7 @@ func (c *AppConfig) DynamicReload(log logger.Logger) {
c.Config.CheckForUpdates = checkUpdates
log.Debug().Msg("config file reloaded!")
c.m.Unlock()
})
viper.WatchConfig()
}
func (c *AppConfig) UpdateConfig() error {