4
0

rename to registry

This commit is contained in:
dc.To 2025-04-27 14:16:23 +08:00
parent 8cdc0939bb
commit 8347daf38d
2 changed files with 18 additions and 7 deletions

View File

@ -1,7 +0,0 @@
package config
import "os"
func Endpoint() string {
return os.Getenv("ETCD_ENDPOINTS")
}

18
registry/etcd.go Normal file
View File

@ -0,0 +1,18 @@
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()))
}
}