4
0

Compare commits

..

No commits in common. "main" and "v1.4.2" have entirely different histories.
main ... v1.4.2

2 changed files with 7 additions and 7 deletions

View File

@ -4,7 +4,7 @@ import (
"context" "context"
"strings" "strings"
"git.blueorigin.work/blueorigin/invoke/apapter" "git.linkiio.cn/linkpay/api/invoke/apapter"
"github.com/gogf/gf/v2/frame/g" "github.com/gogf/gf/v2/frame/g"
"google.golang.org/grpc" "google.golang.org/grpc"
"google.golang.org/grpc/metadata" "google.golang.org/grpc/metadata"

View File

@ -4,20 +4,20 @@ import (
"os" "os"
"path/filepath" "path/filepath"
"git.blueorigin.work/blueorigin/invoke/chain" "git.linkiio.cn/linkpay/invoke/chain"
"git.blueorigin.work/blueorigin/protobuf" "git.linkiio.cn/linkpay/protobuf"
"github.com/gogf/gf/contrib/registry/etcd/v2" "github.com/gogf/gf/contrib/registry/etcd/v2"
"github.com/gogf/gf/contrib/rpc/grpcx/v2" "github.com/gogf/gf/contrib/rpc/grpcx/v2"
"google.golang.org/grpc" "google.golang.org/grpc"
"google.golang.org/grpc/reflection" "google.golang.org/grpc/reflection"
) )
var Endpoints = os.Getenv("ETCD_ENDPOINTS") var Endpoint = os.Getenv("ETCD_ENDPOINTS")
var GrpcConfig *grpcx.GrpcServerConfig = grpcx.Server.NewConfig() var GrpcConfig *grpcx.GrpcServerConfig = grpcx.Server.NewConfig()
func Etcd() *etcd.Registry { func Etcd() *etcd.Registry {
return etcd.New(Endpoints) return etcd.New(Endpoint)
} }
func SetOptions(o ...grpc.ServerOption) *grpcx.GrpcServerConfig { func SetOptions(o ...grpc.ServerOption) *grpcx.GrpcServerConfig {
@ -40,7 +40,7 @@ func Registry(f ...func(s *grpcx.GrpcServer)) *grpcx.GrpcServer {
chain.ClientMetadataUnaryChain, chain.ClientMetadataUnaryChain,
)}..., )}...,
) )
if Endpoints != "" { if Endpoint != "" {
grpcx.Resolver.Register(Etcd()) grpcx.Resolver.Register(Etcd())
} }
@ -65,7 +65,7 @@ func Registry(f ...func(s *grpcx.GrpcServer)) *grpcx.GrpcServer {
* @version 20250427 * @version 20250427
*/ */
func Reflect(s reflection.GRPCServer, f ...func()) { func Reflect(s reflection.GRPCServer, f ...func()) {
if Endpoints == "" { if Endpoint == "" {
reflection.Register(s) reflection.Register(s)
} }
for _, fn := range f { for _, fn := range f {