mirror of
https://github.com/openimsdk/open-im-server.git
synced 2025-10-29 07:12:14 +08:00
update
This commit is contained in:
parent
593972e9c9
commit
dc7426c54f
Binary file not shown.
@ -22,6 +22,9 @@ import (
|
||||
|
||||
func main() {
|
||||
authCmd := cmd.NewRpcCmd("auth")
|
||||
authCmd.PreLoadConfig()
|
||||
authCmd.SetSvcName(config.Config.RpcRegisterName.OpenImAuthName)
|
||||
|
||||
authCmd.AddPortFlag()
|
||||
authCmd.AddPrometheusPortFlag()
|
||||
if err := authCmd.Exec(); err != nil {
|
||||
|
||||
Binary file not shown.
@ -21,12 +21,16 @@ import (
|
||||
)
|
||||
|
||||
func main() {
|
||||
rpcCmd := cmd.NewRpcCmd("user")
|
||||
rpcCmd := cmd.NewRpcCmd("")
|
||||
rpcCmd.PreLoadConfig()
|
||||
rpcCmd.SetSvcName(config.Config.RpcRegisterName.OpenImUserName)
|
||||
|
||||
rpcCmd.AddPortFlag()
|
||||
rpcCmd.AddPrometheusPortFlag()
|
||||
if err := rpcCmd.Exec(); err != nil {
|
||||
panic(err.Error())
|
||||
}
|
||||
|
||||
if err := rpcCmd.StartSvr(config.Config.RpcRegisterName.OpenImUserName, user.Start); err != nil {
|
||||
panic(err.Error())
|
||||
}
|
||||
|
||||
@ -185,7 +185,7 @@ rpcPort:
|
||||
openImGroupPort: [ 10150 ]
|
||||
openImAuthPort: [ 10160 ]
|
||||
openImPushPort: [ 10170 ]
|
||||
openImConversationPort: [ 10180 ]
|
||||
openImConversationPort: [ 10230 ]
|
||||
openImThirdPort: [ 10190 ]
|
||||
|
||||
###################### RPC Register Name Configuration ######################
|
||||
@ -405,5 +405,5 @@ prometheus:
|
||||
pushPrometheusPort: [ 20170 ]
|
||||
conversationPrometheusPort: [ 20230 ]
|
||||
rtcPrometheusPort: [ 21300 ]
|
||||
thirdPrometheusPort: [ 21301 ]
|
||||
thirdPrometheusPort: [ 20190 ]
|
||||
messageTransferPrometheusPort: [ 21400, 21401, 21402, 21403 ] # List of ports
|
||||
|
||||
@ -78,6 +78,16 @@ func NewRootCmd(name string, opts ...func(*CmdOpts)) (rootCmd *RootCmd) {
|
||||
return rootCmd
|
||||
}
|
||||
|
||||
func (r *RootCmd) PreLoadConfig() {
|
||||
if err := config2.InitConfig(""); err != nil {
|
||||
panic(err)
|
||||
}
|
||||
}
|
||||
|
||||
func (r *RootCmd) SetSvcName(name string) {
|
||||
r.Name = name
|
||||
}
|
||||
|
||||
func (r *RootCmd) addConfFlag() {
|
||||
r.Command.Flags().StringP(constant.FlagConf, "c", "", "Path to config file folder")
|
||||
}
|
||||
@ -105,6 +115,34 @@ func (r *RootCmd) getPrometheusPortFlag(cmd *cobra.Command) int {
|
||||
}
|
||||
|
||||
func (r *RootCmd) GetPrometheusPortFlag() int {
|
||||
if r.prometheusPort == 0 {
|
||||
switch r.Name {
|
||||
case config.Config.RpcRegisterName.OpenImAuthName:
|
||||
return config.Config.Prometheus.AuthPrometheusPort[0]
|
||||
case config.Config.RpcRegisterName.OpenImUserName:
|
||||
return config.Config.Prometheus.UserPrometheusPort[0]
|
||||
case config.Config.RpcRegisterName.OpenImFriendName:
|
||||
return config.Config.Prometheus.FriendPrometheusPort[0]
|
||||
case config.Config.RpcRegisterName.OpenImGroupName:
|
||||
return config.Config.Prometheus.GroupPrometheusPort[0]
|
||||
case config.Config.RpcRegisterName.OpenImMsgName:
|
||||
return config.Config.Prometheus.MessagePrometheusPort[0]
|
||||
case config.Config.RpcRegisterName.OpenImConversationName:
|
||||
return config.Config.Prometheus.ConversationPrometheusPort[0]
|
||||
case config.Config.RpcRegisterName.OpenImConversationName:
|
||||
return config.Config.Prometheus.ConversationPrometheusPort[0]
|
||||
case config.Config.RpcRegisterName.OpenImPushName:
|
||||
return config.Config.Prometheus.PushPrometheusPort[0]
|
||||
case config.Config.RpcRegisterName.OpenImMessageGatewayName:
|
||||
return config.Config.Prometheus.MessageGatewayPrometheusPort[0]
|
||||
case config.Config.RpcRegisterName.OpenImThirdName:
|
||||
return config.Config.Prometheus.ThirdPrometheusPort[0]
|
||||
default:
|
||||
return 0
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
return r.prometheusPort
|
||||
}
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user