4
0

update etcd variable

This commit is contained in:
dc.To 2025-08-07 10:03:10 +08:00
parent 981e1e0cf0
commit fed21bfb86

View File

@ -12,12 +12,12 @@ import (
"google.golang.org/grpc/reflection"
)
var Endpoint = os.Getenv("ETCD_ENDPOINTS")
var Endpoints = os.Getenv("ETCD_ENDPOINTS")
var GrpcConfig *grpcx.GrpcServerConfig = grpcx.Server.NewConfig()
func Etcd() *etcd.Registry {
return etcd.New(Endpoint)
return etcd.New(Endpoints)
}
func SetOptions(o ...grpc.ServerOption) *grpcx.GrpcServerConfig {
@ -40,7 +40,7 @@ func Registry(f ...func(s *grpcx.GrpcServer)) *grpcx.GrpcServer {
chain.ClientMetadataUnaryChain,
)}...,
)
if Endpoint != "" {
if Endpoints != "" {
grpcx.Resolver.Register(Etcd())
}
@ -65,7 +65,7 @@ func Registry(f ...func(s *grpcx.GrpcServer)) *grpcx.GrpcServer {
* @version 20250427
*/
func Reflect(s reflection.GRPCServer, f ...func()) {
if Endpoint == "" {
if Endpoints == "" {
reflection.Register(s)
}
for _, fn := range f {