test sse
This commit is contained in:
@@ -11,6 +11,7 @@ import (
|
||||
"log"
|
||||
"time"
|
||||
|
||||
"github.com/fsnotify/fsnotify"
|
||||
"github.com/go-ini/ini"
|
||||
"github.com/spf13/viper"
|
||||
)
|
||||
@@ -81,6 +82,12 @@ func SetUp1() {
|
||||
log.Fatalf("Error reading config file, %s", err)
|
||||
}
|
||||
|
||||
viper.WatchConfig()
|
||||
viper.OnConfigChange(func(e fsnotify.Event) {
|
||||
// 配置文件发生变更之后会调用的回调函数
|
||||
fmt.Println("Config file changed:", e.Name)
|
||||
})
|
||||
|
||||
// 获取配置值
|
||||
mysqlHost := viper.GetString("mysql.Host")
|
||||
jwtSecretKey := viper.GetString("jwt.SecretKey")
|
||||
|
||||
Reference in New Issue
Block a user