mirror of
https://github.com/openimsdk/open-im-server.git
synced 2025-11-05 11:52:10 +08:00
refactor: cmd update.
This commit is contained in:
parent
df2a1d9f02
commit
4d198ea6e3
@ -40,7 +40,7 @@ func NewApiCmd() *ApiCmd {
|
||||
}
|
||||
ret.RootCmd = NewRootCmd(program.GetProcessName(), WithConfigMap(ret.configMap))
|
||||
ret.ctx = context.WithValue(context.Background(), "version", config.Version)
|
||||
ret.Command.PreRunE = func(cmd *cobra.Command, args []string) error {
|
||||
ret.Command.RunE = func(cmd *cobra.Command, args []string) error {
|
||||
return ret.preRunE()
|
||||
}
|
||||
return ret
|
||||
|
||||
@ -41,7 +41,7 @@ func NewAuthRpcCmd() *AuthRpcCmd {
|
||||
}
|
||||
ret.RootCmd = NewRootCmd(program.GetProcessName(), WithConfigMap(ret.configMap))
|
||||
ret.ctx = context.WithValue(context.Background(), "version", config.Version)
|
||||
ret.Command.PreRunE = func(cmd *cobra.Command, args []string) error {
|
||||
ret.Command.RunE = func(cmd *cobra.Command, args []string) error {
|
||||
return ret.preRunE()
|
||||
}
|
||||
|
||||
|
||||
@ -44,8 +44,8 @@ func NewConversationRpcCmd() *ConversationRpcCmd {
|
||||
}
|
||||
ret.RootCmd = NewRootCmd(program.GetProcessName(), WithConfigMap(ret.configMap))
|
||||
ret.ctx = context.WithValue(context.Background(), "version", config.Version)
|
||||
ret.Command.PreRunE = func(cmd *cobra.Command, args []string) error {
|
||||
return ret.preRunE()
|
||||
ret.Command.RunE = func(cmd *cobra.Command, args []string) error {
|
||||
return ret.runE()
|
||||
}
|
||||
return ret
|
||||
}
|
||||
@ -54,7 +54,7 @@ func (a *ConversationRpcCmd) Exec() error {
|
||||
return a.Execute()
|
||||
}
|
||||
|
||||
func (a *ConversationRpcCmd) preRunE() error {
|
||||
func (a *ConversationRpcCmd) runE() error {
|
||||
return startrpc.Start(a.ctx, &a.conversationConfig.ZookeeperConfig, &a.conversationConfig.RpcConfig.Prometheus, a.conversationConfig.RpcConfig.RPC.ListenIP,
|
||||
a.conversationConfig.RpcConfig.RPC.RegisterIP, a.conversationConfig.RpcConfig.RPC.Ports,
|
||||
a.Index(), a.conversationConfig.Share.RpcRegisterName.Conversation, &a.conversationConfig.Share, a.conversationConfig, conversation.Start)
|
||||
|
||||
@ -42,7 +42,7 @@ func NewCronTaskCmd() *CronTaskCmd {
|
||||
}
|
||||
ret.RootCmd = NewRootCmd(program.GetProcessName(), WithConfigMap(ret.configMap))
|
||||
ret.ctx = context.WithValue(context.Background(), "version", config.Version)
|
||||
ret.Command.PreRunE = func(cmd *cobra.Command, args []string) error {
|
||||
ret.Command.RunE = func(cmd *cobra.Command, args []string) error {
|
||||
return ret.preRunE()
|
||||
}
|
||||
return ret
|
||||
|
||||
@ -45,7 +45,7 @@ func NewFriendRpcCmd() *FriendRpcCmd {
|
||||
}
|
||||
ret.RootCmd = NewRootCmd(program.GetProcessName(), WithConfigMap(ret.configMap))
|
||||
ret.ctx = context.WithValue(context.Background(), "version", config.Version)
|
||||
ret.Command.PreRunE = func(cmd *cobra.Command, args []string) error {
|
||||
ret.Command.RunE = func(cmd *cobra.Command, args []string) error {
|
||||
return ret.preRunE()
|
||||
}
|
||||
return ret
|
||||
|
||||
@ -46,7 +46,7 @@ func NewMsgRpcCmd() *MsgRpcCmd {
|
||||
}
|
||||
ret.RootCmd = NewRootCmd(program.GetProcessName(), WithConfigMap(ret.configMap))
|
||||
ret.ctx = context.WithValue(context.Background(), "version", config.Version)
|
||||
ret.Command.PreRunE = func(cmd *cobra.Command, args []string) error {
|
||||
ret.Command.RunE = func(cmd *cobra.Command, args []string) error {
|
||||
return ret.preRunE()
|
||||
}
|
||||
return ret
|
||||
|
||||
@ -42,7 +42,7 @@ func NewMsgGatewayCmd() *MsgGatewayCmd {
|
||||
}
|
||||
ret.RootCmd = NewRootCmd(program.GetProcessName(), WithConfigMap(ret.configMap))
|
||||
ret.ctx = context.WithValue(context.Background(), "version", config.Version)
|
||||
ret.Command.PreRunE = func(cmd *cobra.Command, args []string) error {
|
||||
ret.Command.RunE = func(cmd *cobra.Command, args []string) error {
|
||||
return ret.preRunE()
|
||||
}
|
||||
return ret
|
||||
|
||||
@ -43,7 +43,7 @@ func NewMsgTransferCmd() *MsgTransferCmd {
|
||||
}
|
||||
ret.RootCmd = NewRootCmd(program.GetProcessName(), WithConfigMap(ret.configMap))
|
||||
ret.ctx = context.WithValue(context.Background(), "version", config.Version)
|
||||
ret.Command.PreRunE = func(cmd *cobra.Command, args []string) error {
|
||||
ret.Command.RunE = func(cmd *cobra.Command, args []string) error {
|
||||
return ret.preRunE()
|
||||
}
|
||||
return ret
|
||||
|
||||
@ -46,7 +46,7 @@ func NewPushRpcCmd() *PushRpcCmd {
|
||||
}
|
||||
ret.RootCmd = NewRootCmd(program.GetProcessName(), WithConfigMap(ret.configMap))
|
||||
ret.ctx = context.WithValue(context.Background(), "version", config.Version)
|
||||
ret.Command.PreRunE = func(cmd *cobra.Command, args []string) error {
|
||||
ret.Command.RunE = func(cmd *cobra.Command, args []string) error {
|
||||
return ret.preRunE()
|
||||
}
|
||||
return ret
|
||||
|
||||
@ -45,7 +45,7 @@ func NewThirdRpcCmd() *ThirdRpcCmd {
|
||||
}
|
||||
ret.RootCmd = NewRootCmd(program.GetProcessName(), WithConfigMap(ret.configMap))
|
||||
ret.ctx = context.WithValue(context.Background(), "version", config.Version)
|
||||
ret.Command.PreRunE = func(cmd *cobra.Command, args []string) error {
|
||||
ret.Command.RunE = func(cmd *cobra.Command, args []string) error {
|
||||
return ret.preRunE()
|
||||
}
|
||||
return ret
|
||||
|
||||
@ -46,7 +46,7 @@ func NewUserRpcCmd() *UserRpcCmd {
|
||||
}
|
||||
ret.RootCmd = NewRootCmd(program.GetProcessName(), WithConfigMap(ret.configMap))
|
||||
ret.ctx = context.WithValue(context.Background(), "version", config.Version)
|
||||
ret.Command.PreRunE = func(cmd *cobra.Command, args []string) error {
|
||||
ret.Command.RunE = func(cmd *cobra.Command, args []string) error {
|
||||
return ret.preRunE()
|
||||
}
|
||||
return ret
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user