19 lines
279 B
Go
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()))
|
|
}
|
|
}
|