This commit is contained in:
wangchuxiao
2023-03-09 12:46:56 +08:00
parent fae6fdc3ed
commit 8904ebccbc
5 changed files with 29 additions and 13 deletions
+5
View File
@@ -0,0 +1,5 @@
package cmd
type AuthCmd struct {
*RpcCmd
}
+11
View File
@@ -26,3 +26,14 @@ func (r *RpcCmd) Exec(rpcRegisterName string, rpcFn func(client discoveryregistr
r.addRpc(rpcRegisterName, rpcFn)
return r.Execute()
}
func (r *RpcCmd) addRpc2(rpcRegisterName *string, rpcFn func(client discoveryregistry.SvcDiscoveryRegistry, server *grpc.Server) error) {
r.Command.RunE = func(cmd *cobra.Command, args []string) error {
return startrpc.Start(r.getPortFlag(cmd), *rpcRegisterName, r.getPrometheusPortFlag(cmd), rpcFn)
}
}
func (r *RpcCmd) Exec2(rpcRegisterName *string, rpcFn func(client discoveryregistry.SvcDiscoveryRegistry, server *grpc.Server) error) error {
r.addRpc2(rpcRegisterName, rpcFn)
return r.Execute()
}