Skip to content

Commit dbf8b23

Browse files
committed
fix: Config watchConfig (lejianwen#135)
--- Closes: lejianwen#135
1 parent 79a5dd5 commit dbf8b23

File tree

1 file changed

+13
-12
lines changed

1 file changed

+13
-12
lines changed

config/config.go

Lines changed: 13 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -56,19 +56,20 @@ func Init(rowVal *Config, path string) *viper.Viper {
5656
if err != nil {
5757
panic(fmt.Errorf("Fatal error config file: %s \n", err))
5858
}
59-
v.WatchConfig()
60-
6159
/*
62-
//监听配置修改没什么必要
63-
v.OnConfigChange(func(e fsnotify.Event) {
64-
//配置文件修改监听
65-
fmt.Println("config file changed:", e.Name)
66-
if err2 := v.Unmarshal(rowVal); err2 != nil {
67-
fmt.Println(err2)
68-
}
69-
rowVal.Rustdesk.LoadKeyFile()
70-
rowVal.Rustdesk.ParsePort()
71-
})
60+
v.WatchConfig()
61+
62+
63+
//监听配置修改没什么必要
64+
v.OnConfigChange(func(e fsnotify.Event) {
65+
//配置文件修改监听
66+
fmt.Println("config file changed:", e.Name)
67+
if err2 := v.Unmarshal(rowVal); err2 != nil {
68+
fmt.Println(err2)
69+
}
70+
rowVal.Rustdesk.LoadKeyFile()
71+
rowVal.Rustdesk.ParsePort()
72+
})
7273
*/
7374
if err := v.Unmarshal(rowVal); err != nil {
7475
fmt.Println(err)

0 commit comments

Comments
 (0)