This commit is contained in:
parent
4c56d907ed
commit
5c718886bd
5
main.go
5
main.go
@ -22,7 +22,7 @@ func initNacos() {
|
|||||||
}
|
}
|
||||||
cc := constant.ClientConfig{
|
cc := constant.ClientConfig{
|
||||||
AppName: "api1",
|
AppName: "api1",
|
||||||
NamespaceId: "public", //namespace id
|
NamespaceId: "", //namespace id
|
||||||
TimeoutMs: 5000,
|
TimeoutMs: 5000,
|
||||||
NotLoadCacheAtStart: true,
|
NotLoadCacheAtStart: true,
|
||||||
RotateTime: "1h",
|
RotateTime: "1h",
|
||||||
@ -47,6 +47,7 @@ func initNacos() {
|
|||||||
Port: pp,
|
Port: pp,
|
||||||
Weight: 10,
|
Weight: 10,
|
||||||
Enable: true,
|
Enable: true,
|
||||||
|
Healthy: true,
|
||||||
ServiceName: "api1",
|
ServiceName: "api1",
|
||||||
Ephemeral: true,
|
Ephemeral: true,
|
||||||
})
|
})
|
||||||
@ -63,7 +64,7 @@ func initNacos() {
|
|||||||
DataId: "api.yml",
|
DataId: "api.yml",
|
||||||
Group: "DEFAULT_GROUP",
|
Group: "DEFAULT_GROUP",
|
||||||
OnChange: func(namespace, group, dataId, data string) {
|
OnChange: func(namespace, group, dataId, data string) {
|
||||||
fmt.Println("group:" + group + ", dataId:" + dataId + ", data:" + data)
|
fmt.Println("监控到配置文件变动: group:" + group + ", dataId:" + dataId + ", data:" + data)
|
||||||
},
|
},
|
||||||
})
|
})
|
||||||
//log.Println("监听配置失败: ", err.Error())
|
//log.Println("监听配置失败: ", err.Error())
|
||||||
|
Loading…
Reference in New Issue
Block a user