Skip to content

Commit

Permalink
fix(config): duplicate config reload logging (#153)
Browse files Browse the repository at this point in the history
  • Loading branch information
nuxencs authored Oct 26, 2024
1 parent 38421c3 commit 9d599f6
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions internal/config/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -411,8 +411,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
Expand Down Expand Up @@ -443,10 +445,7 @@ func (c *AppConfig) DynamicReload(log logger.Logger) {
c.Config.Notifications.Discord = discordWebhook

log.Debug().Msg("config file reloaded!")

c.m.Unlock()
})
viper.WatchConfig()
}

func (c *AppConfig) UpdateConfig() error {
Expand Down

0 comments on commit 9d599f6

Please sign in to comment.