@@ -47,64 +47,6 @@ func init() {
4747 prommetrics .RegistryAll ()
4848}
4949
50- func getConfigRpcMaxRequestBody (value reflect.Value ) * conf.MaxRequestBody {
51- for value .Kind () == reflect .Pointer {
52- value = value .Elem ()
53- }
54- if value .Kind () == reflect .Struct {
55- num := value .NumField ()
56- for i := 0 ; i < num ; i ++ {
57- field := value .Field (i )
58- if ! field .CanInterface () {
59- continue
60- }
61- for field .Kind () == reflect .Pointer {
62- field = field .Elem ()
63- }
64- switch elem := field .Interface ().(type ) {
65- case conf.Share :
66- return & elem .RPCMaxBodySize
67- case conf.MaxRequestBody :
68- return & elem
69- }
70- if field .Kind () == reflect .Struct {
71- if elem := getConfigRpcMaxRequestBody (field ); elem != nil {
72- return elem
73- }
74- }
75- }
76- }
77- return nil
78- }
79-
80- func getConfigShare (value reflect.Value ) * conf.Share {
81- for value .Kind () == reflect .Pointer {
82- value = value .Elem ()
83- }
84- if value .Kind () == reflect .Struct {
85- num := value .NumField ()
86- for i := 0 ; i < num ; i ++ {
87- field := value .Field (i )
88- if ! field .CanInterface () {
89- continue
90- }
91- for field .Kind () == reflect .Pointer {
92- field = field .Elem ()
93- }
94- switch elem := field .Interface ().(type ) {
95- case conf.Share :
96- return & elem
97- }
98- if field .Kind () == reflect .Struct {
99- if elem := getConfigShare (field ); elem != nil {
100- return elem
101- }
102- }
103- }
104- }
105- return nil
106- }
107-
10850func Start [T any ](ctx context.Context , disc * conf.Discovery , prometheusConfig * conf.Prometheus , listenIP ,
10951 registerIP string , autoSetPorts bool , rpcPorts []int , index int , rpcRegisterName string , notification * conf.Notification , config T ,
11052 watchConfigNames []string , watchServiceNames []string ,
@@ -122,8 +64,8 @@ func Start[T any](ctx context.Context, disc *conf.Discovery, prometheusConfig *c
12264
12365 options = append (options ,
12466 grpcsrv .GrpcServerMetadataContext (),
125- grpcsrv .GrpcServerLogger (),
12667 grpcsrv .GrpcServerErrorConvert (),
68+ grpcsrv .GrpcServerLogger (),
12769 grpcsrv .GrpcServerRequestValidate (),
12870 grpcsrv .GrpcServerPanicCapture (),
12971 )
0 commit comments