mirror of
https://github.com/TeaOSLab/EdgeAPI.git
synced 2025-11-02 22:10:26 +08:00
API节点自动生成实例代号,用来外界查询多个API节点实例是否为同一个
This commit is contained in:
@@ -161,6 +161,20 @@ func main() {
|
||||
}
|
||||
}
|
||||
})
|
||||
app.On("instance", func() {
|
||||
var sock = gosock.NewTmpSock(teaconst.ProcessName)
|
||||
reply, err := sock.Send(&gosock.Command{Code: "instance"})
|
||||
if err != nil {
|
||||
fmt.Println("[ERROR]" + err.Error())
|
||||
} else {
|
||||
replyJSON, err := json.MarshalIndent(reply.Params, "", " ")
|
||||
if err != nil {
|
||||
fmt.Println("[ERROR]marshal result failed: " + err.Error())
|
||||
} else {
|
||||
fmt.Println(string(replyJSON))
|
||||
}
|
||||
}
|
||||
})
|
||||
|
||||
app.Run(func() {
|
||||
nodes.NewAPINode().Start()
|
||||
|
||||
Reference in New Issue
Block a user