-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathreload.go
31 lines (29 loc) · 926 Bytes
/
reload.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
package dockersync
import (
"github.com/Altinity/docker-sync/config"
"github.com/rs/zerolog/log"
)
// Reload refreshes the rate limiting configuration.
func Reload() {
if reloadedKeys := config.Reload(); reloadedKeys != nil {
for k := range reloadedKeys {
if reloadedKeys[k].Error != nil {
log.Error().
Err(reloadedKeys[k].Error).
Str("key", reloadedKeys[k].Key).
Interface("oldValue", reloadedKeys[k].OldValue).
Interface("newValue", reloadedKeys[k].NewValue).
Msg("Failed to load configuration key, ignoring")
} else if reloadedKeys[k].OldValue != nil {
// Skip logging if the key was not previously set (i.e. it was loaded for the first time)
/*
log.Info().
Str("key", reloadedKeys[k].Key).
Interface("oldValue", reloadedKeys[k].OldValue).
Interface("newValue", reloadedKeys[k].NewValue).
Msg("Loaded configuration key")
*/
}
}
}
}