mirror of
https://github.com/openimsdk/open-im-server.git
synced 2025-06-11 20:19:18 +08:00
fix: monolithic
This commit is contained in:
parent
c2b035839d
commit
edc2bcc2f1
@ -100,7 +100,7 @@ func (x *cmds) readConfig() error {
|
||||
}
|
||||
x.conf[getTypePath(field.Type())] = data
|
||||
}
|
||||
val := config.Discovery{Enable: discovery.Standalone}
|
||||
val := config.Discovery{Enable: config.Standalone}
|
||||
var buf bytes.Buffer
|
||||
if err := yaml.NewEncoder(&buf).Encode(&val); err != nil {
|
||||
return err
|
||||
|
@ -176,11 +176,10 @@ func (m *MsgTransfer) Start(index int, config *Config, client discovery.SvcDisco
|
||||
return listener, port, nil
|
||||
}
|
||||
|
||||
if config.MsgTransfer.Prometheus.AutoSetPorts && config.Discovery.Enable != conf.ETCD {
|
||||
return errs.New("only etcd support autoSetPorts", "RegisterName", "api").Wrap()
|
||||
}
|
||||
|
||||
if config.MsgTransfer.Prometheus.Enable {
|
||||
if config.Discovery.Enable != conf.Standalone && config.MsgTransfer.Prometheus.Enable {
|
||||
if config.MsgTransfer.Prometheus.AutoSetPorts && config.Discovery.Enable != conf.ETCD {
|
||||
return errs.New("only etcd support autoSetPorts", "RegisterName", "api").Wrap()
|
||||
}
|
||||
var (
|
||||
listener net.Listener
|
||||
prometheusPort int
|
||||
|
@ -21,6 +21,7 @@ const (
|
||||
DeploymentType = "DEPLOYMENT_TYPE"
|
||||
KUBERNETES = "kubernetes"
|
||||
ETCD = "etcd"
|
||||
Standalone = "standalone"
|
||||
)
|
||||
|
||||
const (
|
||||
|
@ -19,6 +19,7 @@ import (
|
||||
|
||||
"github.com/openimsdk/open-im-server/v3/pkg/common/config"
|
||||
"github.com/openimsdk/tools/discovery"
|
||||
"github.com/openimsdk/tools/discovery/standalone"
|
||||
"google.golang.org/grpc"
|
||||
|
||||
"github.com/openimsdk/tools/discovery/kubernetes"
|
||||
@ -38,6 +39,8 @@ func NewDiscoveryRegister(discovery *config.Discovery, runtimeEnv string, watchN
|
||||
}
|
||||
|
||||
switch discovery.Enable {
|
||||
case config.Standalone:
|
||||
return standalone.GetSvcDiscoveryRegistry(), nil
|
||||
case config.ETCD:
|
||||
return etcd.NewSvcDiscoveryRegistry(
|
||||
discovery.Etcd.RootDirectory,
|
||||
|
@ -53,6 +53,14 @@ func Start[T any](ctx context.Context, discovery *conf.Discovery, prometheusConf
|
||||
rpcFn func(ctx context.Context, config T, client discovery.Conn, server grpc.ServiceRegistrar) error,
|
||||
options ...grpc.ServerOption) error {
|
||||
|
||||
if notification != nil {
|
||||
conf.InitNotification(notification)
|
||||
}
|
||||
|
||||
if discovery.Enable == conf.Standalone {
|
||||
return nil
|
||||
}
|
||||
|
||||
watchConfigNames = append(watchConfigNames, conf.LogConfigFileName)
|
||||
var (
|
||||
rpcTcpAddr string
|
||||
@ -61,10 +69,6 @@ func Start[T any](ctx context.Context, discovery *conf.Discovery, prometheusConf
|
||||
prometheusPort int
|
||||
)
|
||||
|
||||
if notification != nil {
|
||||
conf.InitNotification(notification)
|
||||
}
|
||||
|
||||
registerIP, err := network.GetRpcRegisterIP(registerIP)
|
||||
if err != nil {
|
||||
return err
|
||||
|
Loading…
x
Reference in New Issue
Block a user