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