Compare commits
3 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
6ed8f159e7 | ||
|
|
c9133edfd9 | ||
|
|
fed21bfb86 |
@ -4,7 +4,7 @@ import (
|
||||
"context"
|
||||
"strings"
|
||||
|
||||
"git.linkiio.cn/linkpay/api/invoke/apapter"
|
||||
"git.blueorigin.work/blueorigin/invoke/apapter"
|
||||
"github.com/gogf/gf/v2/frame/g"
|
||||
"google.golang.org/grpc"
|
||||
"google.golang.org/grpc/metadata"
|
||||
|
||||
@ -4,20 +4,20 @@ import (
|
||||
"os"
|
||||
"path/filepath"
|
||||
|
||||
"git.linkiio.cn/linkpay/invoke/chain"
|
||||
"git.linkiio.cn/linkpay/protobuf"
|
||||
"git.blueorigin.work/blueorigin/invoke/chain"
|
||||
"git.blueorigin.work/blueorigin/protobuf"
|
||||
"github.com/gogf/gf/contrib/registry/etcd/v2"
|
||||
"github.com/gogf/gf/contrib/rpc/grpcx/v2"
|
||||
"google.golang.org/grpc"
|
||||
"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 {
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user