mirror of
https://github.com/spf13/viper
synced 2025-05-07 20:57:18 +00:00
Update viper.go
This commit is contained in:
parent
3b18b32fd3
commit
6c4d359745
1 changed files with 3 additions and 5 deletions
8
viper.go
8
viper.go
|
@ -421,18 +421,16 @@ var SupportedExts = []string{"json", "toml", "yaml", "yml", "properties", "props
|
|||
// SupportedRemoteProviders are universally supported remote providers.
|
||||
var SupportedRemoteProviders = []string{"etcd", "etcd3", "consul", "firestore"}
|
||||
|
||||
// OnConfigChange is used to implement a response on config files change.
|
||||
// OnConfigChange sets the event handler that is called when a config file changes.
|
||||
func OnConfigChange(run func(in fsnotify.Event)) { v.OnConfigChange(run) }
|
||||
func (v *Viper) OnConfigChange(run func(in fsnotify.Event)) {
|
||||
v.onConfigChange = run
|
||||
}
|
||||
|
||||
// WatchConfig is watching changes on config files
|
||||
// to start event in OnConfigChange. Used for global viper config.
|
||||
// WatchConfig starts watching a config file for changes.
|
||||
func WatchConfig() { v.WatchConfig() }
|
||||
|
||||
// WatchConfig is watching changes on config files
|
||||
// to start event in OnConfigChange.
|
||||
// WatchConfig starts watching a config file for changes.
|
||||
func (v *Viper) WatchConfig() {
|
||||
initWG := sync.WaitGroup{}
|
||||
initWG.Add(1)
|
||||
|
|
Loading…
Add table
Reference in a new issue