mirror of
https://github.com/spf13/viper
synced 2025-05-15 08:37:19 +00:00
Merge pull request #1 from lianxmfor/lianxmfor-patch-1
update readme.md
This commit is contained in:
commit
098d694990
1 changed files with 1 additions and 1 deletions
|
@ -175,10 +175,10 @@ Optionally you can provide a function for Viper to run each time a change occurs
|
||||||
**Make sure you add all of the configPaths prior to calling `WatchConfig()`**
|
**Make sure you add all of the configPaths prior to calling `WatchConfig()`**
|
||||||
|
|
||||||
```go
|
```go
|
||||||
viper.WatchConfig()
|
|
||||||
viper.OnConfigChange(func(e fsnotify.Event) {
|
viper.OnConfigChange(func(e fsnotify.Event) {
|
||||||
fmt.Println("Config file changed:", e.Name)
|
fmt.Println("Config file changed:", e.Name)
|
||||||
})
|
})
|
||||||
|
viper.WatchConfig()
|
||||||
```
|
```
|
||||||
|
|
||||||
### Reading Config from io.Reader
|
### Reading Config from io.Reader
|
||||||
|
|
Loading…
Add table
Reference in a new issue