Skip to content

Commit

Permalink
Add DocBlock to WatchConfig (#1467)
Browse files Browse the repository at this point in the history
* Add DocBlock to WatchConfig

Added a small description of the WatchConfig().
So that you can understand in the ide why you could use it.

* Update viper.go

* update viper.go

Signed-off-by: Mark Sagi-Kazar <mark.sagikazar@gmail.com>

Signed-off-by: Mark Sagi-Kazar <mark.sagikazar@gmail.com>
Co-authored-by: Márk Sági-Kazár <sagikazarmark@users.noreply.github.com>
Co-authored-by: Mark Sagi-Kazar <mark.sagikazar@gmail.com>
  • Loading branch information
3 people authored Jan 19, 2023
1 parent 0755477 commit 5182412
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions viper.go
Original file line number Diff line number Diff line change
Expand Up @@ -421,13 +421,18 @@ var SupportedExts = []string{"json", "toml", "yaml", "yml", "properties", "props
// SupportedRemoteProviders are universally supported remote providers.
var SupportedRemoteProviders = []string{"etcd", "etcd3", "consul", "firestore"}

// OnConfigChange sets the event handler that is called when a config file changes.
func OnConfigChange(run func(in fsnotify.Event)) { v.OnConfigChange(run) }

// OnConfigChange sets the event handler that is called when a config file changes.
func (v *Viper) OnConfigChange(run func(in fsnotify.Event)) {
v.onConfigChange = run
}

// WatchConfig starts watching a config file for changes.
func WatchConfig() { v.WatchConfig() }

// WatchConfig starts watching a config file for changes.
func (v *Viper) WatchConfig() {
initWG := sync.WaitGroup{}
initWG.Add(1)
Expand Down

0 comments on commit 5182412

Please sign in to comment.