test-errcode
wangchuxiao 2 years ago
parent fae6fdc3ed
commit 8904ebccbc

@ -12,7 +12,7 @@ func main() {
rpcCmd := cmd.NewRpcCmd()
rpcCmd.AddPortFlag()
rpcCmd.AddPrometheusPortFlag()
if err := rpcCmd.Exec(config.Config.RpcRegisterName.OpenImAuthName, auth.Start); err != nil {
if err := rpcCmd.Exec(*config.Config.RpcRegisterName.OpenImAuthName, auth.Start); err != nil {
fmt.Println(err.Error())
os.Exit(1)
}

@ -20,7 +20,7 @@ type Auth struct {
}
func (o *Auth) client() (auth.AuthClient, error) {
conn, err := o.c.GetConn(config.Config.RpcRegisterName.OpenImAuthName)
conn, err := o.c.GetConn(*config.Config.RpcRegisterName.OpenImAuthName)
if err != nil {
return nil, err
}

@ -0,0 +1,5 @@
package cmd
type AuthCmd struct {
*RpcCmd
}

@ -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()
}

@ -165,7 +165,7 @@ type config struct {
OpenImPushName string `yaml:"openImPushName"`
OpenImMessageGatewayName string `yaml:"openImMessageGatewayName"`
OpenImGroupName string `yaml:"openImGroupName"`
OpenImAuthName string `yaml:"openImAuthName"`
OpenImAuthName *string `yaml:"openImAuthName"`
OpenImConversationName string `yaml:"openImConversationName"`
OpenImCacheName string `yaml:"openImCacheName"`
OpenImRtcName string `yaml:"openImRtcName"`

Loading…
Cancel
Save