Added zrpc server custom serverID for custom registration Key when the service is registered on ETCD. (#3008)

This commit is contained in:
Shyunn
2023-03-11 14:34:28 +08:00
committed by GitHub
parent 4cef2b412c
commit 544aa7c432
4 changed files with 44 additions and 1 deletions

View File

@@ -26,6 +26,9 @@ func NewRpcPubServer(etcd discov.EtcdConf, listenOn string, middlewares ServerMi
pubOpts = append(pubOpts, discov.WithPubEtcdTLS(etcd.CertFile, etcd.CertKeyFile,
etcd.CACertFile, etcd.InsecureSkipVerify))
}
if etcd.HasServerID() {
pubOpts = append(pubOpts, discov.WithId(etcd.ServerID))
}
pubClient := discov.NewPublisher(etcd.Hosts, etcd.Key, pubListenOn, pubOpts...)
return pubClient.KeepAlive()
}