mirror of
https://github.com/openimsdk/open-im-server.git
synced 2025-05-07 11:06:39 +08:00
etcd naming and discovery
This commit is contained in:
parent
eef480efb1
commit
21eb693629
@ -32,11 +32,9 @@ const (
|
|||||||
)
|
)
|
||||||
|
|
||||||
// NewDiscoveryRegister creates a new service discovery and registry client based on the provided environment type.
|
// NewDiscoveryRegister creates a new service discovery and registry client based on the provided environment type.
|
||||||
func NewDiscoveryRegister(zookeeperConfig *config.ZooKeeper, share *config.Share) (discovery.SvcDiscoveryRegistry1, error) {
|
func NewDiscoveryRegister(zookeeperConfig *config.ZooKeeper, share *config.Share) (discovery.SvcDiscoveryRegistry, error) {
|
||||||
return getcd.NewSvcDiscoveryRegistry("openim", []string{"http://localhost:2379"})
|
|
||||||
switch share.Env {
|
switch share.Env {
|
||||||
case zookeeperConst:
|
case zookeeperConst:
|
||||||
|
|
||||||
return zookeeper.NewZkClient(
|
return zookeeper.NewZkClient(
|
||||||
zookeeperConfig.Address,
|
zookeeperConfig.Address,
|
||||||
zookeeperConfig.Schema,
|
zookeeperConfig.Schema,
|
||||||
|
@ -46,7 +46,7 @@ import (
|
|||||||
// Start rpc server.
|
// Start rpc server.
|
||||||
func Start[T any](ctx context.Context, zookeeperConfig *config2.ZooKeeper, prometheusConfig *config2.Prometheus, listenIP,
|
func Start[T any](ctx context.Context, zookeeperConfig *config2.ZooKeeper, prometheusConfig *config2.Prometheus, listenIP,
|
||||||
registerIP string, rpcPorts []int, index int, rpcRegisterName string, share *config2.Share, config T, rpcFn func(ctx context.Context,
|
registerIP string, rpcPorts []int, index int, rpcRegisterName string, share *config2.Share, config T, rpcFn func(ctx context.Context,
|
||||||
config T, client discovery.SvcDiscoveryRegistry1, server *grpc.Server) error, options ...grpc.ServerOption) error {
|
config T, client discovery.SvcDiscoveryRegistry, server *grpc.Server) error, options ...grpc.ServerOption) error {
|
||||||
|
|
||||||
rpcPort, err := datautil.GetElemByIndex(rpcPorts, index)
|
rpcPort, err := datautil.GetElemByIndex(rpcPorts, index)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user