jjzjj

onConfigChange

全部标签

go - 如何使用 golang viper Watchconfig & onConfigChange

我正在尝试使用golangviper读取我的应用程序配置,并希望始终读取最新的配置。请在下面找到我的代码配置.gopackageconfigimport("github.com/spf13/viper""log""github.com/fsnotify/fsnotify""time")typeReaderinterface{GetAllKeys()[]stringGet(keystring)interface{}GetBool(keystring)boolGetString(keystring)string}typeviperConfigReaderstruct{viper*viper