4
0
invoke/registry/etcd.go
2025-04-27 14:16:23 +08:00

19 lines
279 B
Go

package config
import (
"os"
"github.com/gogf/gf/contrib/registry/etcd/v2"
"github.com/gogf/gf/contrib/rpc/grpcx/v2"
)
func Endpoint() string {
return os.Getenv("ETCD_ENDPOINTS")
}
func Etcd() {
if Endpoint() != "" {
grpcx.Resolver.Register(etcd.New(Endpoint()))
}
}