|
|
@ -17,7 +17,7 @@ package cmd
|
|
|
|
import (
|
|
|
|
import (
|
|
|
|
"context"
|
|
|
|
"context"
|
|
|
|
|
|
|
|
|
|
|
|
"github.com/openimsdk/open-im-server/v3/internal/rpc/friend"
|
|
|
|
"github.com/openimsdk/open-im-server/v3/internal/rpc/relation"
|
|
|
|
"github.com/openimsdk/open-im-server/v3/pkg/common/startrpc"
|
|
|
|
"github.com/openimsdk/open-im-server/v3/pkg/common/startrpc"
|
|
|
|
"github.com/openimsdk/open-im-server/v3/version"
|
|
|
|
"github.com/openimsdk/open-im-server/v3/version"
|
|
|
|
"github.com/openimsdk/tools/system/program"
|
|
|
|
"github.com/openimsdk/tools/system/program"
|
|
|
@ -26,23 +26,23 @@ import (
|
|
|
|
|
|
|
|
|
|
|
|
type FriendRpcCmd struct {
|
|
|
|
type FriendRpcCmd struct {
|
|
|
|
*RootCmd
|
|
|
|
*RootCmd
|
|
|
|
ctx context.Context
|
|
|
|
ctx context.Context
|
|
|
|
configMap map[string]any
|
|
|
|
configMap map[string]any
|
|
|
|
friendConfig *friend.Config
|
|
|
|
relationConfig *relation.Config
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
func NewFriendRpcCmd() *FriendRpcCmd {
|
|
|
|
func NewFriendRpcCmd() *FriendRpcCmd {
|
|
|
|
var friendConfig friend.Config
|
|
|
|
var relationConfig relation.Config
|
|
|
|
ret := &FriendRpcCmd{friendConfig: &friendConfig}
|
|
|
|
ret := &FriendRpcCmd{relationConfig: &relationConfig}
|
|
|
|
ret.configMap = map[string]any{
|
|
|
|
ret.configMap = map[string]any{
|
|
|
|
OpenIMRPCFriendCfgFileName: &friendConfig.RpcConfig,
|
|
|
|
OpenIMRPCFriendCfgFileName: &relationConfig.RpcConfig,
|
|
|
|
RedisConfigFileName: &friendConfig.RedisConfig,
|
|
|
|
RedisConfigFileName: &relationConfig.RedisConfig,
|
|
|
|
MongodbConfigFileName: &friendConfig.MongodbConfig,
|
|
|
|
MongodbConfigFileName: &relationConfig.MongodbConfig,
|
|
|
|
ShareFileName: &friendConfig.Share,
|
|
|
|
ShareFileName: &relationConfig.Share,
|
|
|
|
NotificationFileName: &friendConfig.NotificationConfig,
|
|
|
|
NotificationFileName: &relationConfig.NotificationConfig,
|
|
|
|
WebhooksConfigFileName: &friendConfig.WebhooksConfig,
|
|
|
|
WebhooksConfigFileName: &relationConfig.WebhooksConfig,
|
|
|
|
LocalCacheConfigFileName: &friendConfig.LocalCacheConfig,
|
|
|
|
LocalCacheConfigFileName: &relationConfig.LocalCacheConfig,
|
|
|
|
DiscoveryConfigFilename: &friendConfig.Discovery,
|
|
|
|
DiscoveryConfigFilename: &relationConfig.Discovery,
|
|
|
|
}
|
|
|
|
}
|
|
|
|
ret.RootCmd = NewRootCmd(program.GetProcessName(), WithConfigMap(ret.configMap))
|
|
|
|
ret.RootCmd = NewRootCmd(program.GetProcessName(), WithConfigMap(ret.configMap))
|
|
|
|
ret.ctx = context.WithValue(context.Background(), "version", version.Version)
|
|
|
|
ret.ctx = context.WithValue(context.Background(), "version", version.Version)
|
|
|
@ -57,7 +57,7 @@ func (a *FriendRpcCmd) Exec() error {
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
func (a *FriendRpcCmd) runE() error {
|
|
|
|
func (a *FriendRpcCmd) runE() error {
|
|
|
|
return startrpc.Start(a.ctx, &a.friendConfig.Discovery, &a.friendConfig.RpcConfig.Prometheus, a.friendConfig.RpcConfig.RPC.ListenIP,
|
|
|
|
return startrpc.Start(a.ctx, &a.relationConfig.Discovery, &a.relationConfig.RpcConfig.Prometheus, a.relationConfig.RpcConfig.RPC.ListenIP,
|
|
|
|
a.friendConfig.RpcConfig.RPC.RegisterIP, a.friendConfig.RpcConfig.RPC.Ports,
|
|
|
|
a.relationConfig.RpcConfig.RPC.RegisterIP, a.relationConfig.RpcConfig.RPC.Ports,
|
|
|
|
a.Index(), a.friendConfig.Share.RpcRegisterName.Friend, &a.friendConfig.Share, a.friendConfig, friend.Start)
|
|
|
|
a.Index(), a.relationConfig.Share.RpcRegisterName.Friend, &a.relationConfig.Share, a.relationConfig, relation.Start)
|
|
|
|
}
|
|
|
|
}
|
|
|
|