4
0

Compare commits

...

3 Commits
v1.4.2 ... main

Author SHA1 Message Date
dc.To
6ed8f159e7 修改依赖路径 2025-08-27 15:03:16 +08:00
dc.To
c9133edfd9 update dependency library 2025-08-07 10:16:58 +08:00
dc.To
fed21bfb86 update etcd variable 2025-08-07 10:03:10 +08:00
2 changed files with 7 additions and 7 deletions

View File

@ -4,7 +4,7 @@ import (
"context" "context"
"strings" "strings"
"git.linkiio.cn/linkpay/api/invoke/apapter" "git.blueorigin.work/blueorigin/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.linkiio.cn/linkpay/invoke/chain" "git.blueorigin.work/blueorigin/invoke/chain"
"git.linkiio.cn/linkpay/protobuf" "git.blueorigin.work/blueorigin/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 Endpoint = os.Getenv("ETCD_ENDPOINTS") var Endpoints = 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(Endpoint) return etcd.New(Endpoints)
} }
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 Endpoint != "" { if Endpoints != "" {
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 Endpoint == "" { if Endpoints == "" {
reflection.Register(s) reflection.Register(s)
} }
for _, fn := range f { for _, fn := range f {