mirror of
https://github.com/idanoo/autobrr
synced 2025-07-23 00:39:13 +00:00
fix(config): log reload message once (#1773)
fix(config): prevent double logging of config reload message
This commit is contained in:
parent
04ffb0b39d
commit
2386a9db31
1 changed files with 2 additions and 3 deletions
|
@ -387,8 +387,10 @@ func (c *AppConfig) load(configPath string) {
|
||||||
}
|
}
|
||||||
|
|
||||||
func (c *AppConfig) DynamicReload(log logger.Logger) {
|
func (c *AppConfig) DynamicReload(log logger.Logger) {
|
||||||
|
viper.WatchConfig()
|
||||||
viper.OnConfigChange(func(e fsnotify.Event) {
|
viper.OnConfigChange(func(e fsnotify.Event) {
|
||||||
c.m.Lock()
|
c.m.Lock()
|
||||||
|
defer c.m.Unlock()
|
||||||
|
|
||||||
logLevel := viper.GetString("logLevel")
|
logLevel := viper.GetString("logLevel")
|
||||||
c.Config.LogLevel = logLevel
|
c.Config.LogLevel = logLevel
|
||||||
|
@ -401,10 +403,7 @@ func (c *AppConfig) DynamicReload(log logger.Logger) {
|
||||||
c.Config.CheckForUpdates = checkUpdates
|
c.Config.CheckForUpdates = checkUpdates
|
||||||
|
|
||||||
log.Debug().Msg("config file reloaded!")
|
log.Debug().Msg("config file reloaded!")
|
||||||
|
|
||||||
c.m.Unlock()
|
|
||||||
})
|
})
|
||||||
viper.WatchConfig()
|
|
||||||
}
|
}
|
||||||
|
|
||||||
func (c *AppConfig) UpdateConfig() error {
|
func (c *AppConfig) UpdateConfig() error {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue