mirror of
https://github.com/openimsdk/open-im-server.git
synced 2025-05-17 09:44:47 +08:00
add etcd
This commit is contained in:
parent
21eb693629
commit
95a1e331b7
2
go.mod
2
go.mod
@ -14,7 +14,7 @@ require (
|
|||||||
github.com/lestrrat-go/file-rotatelogs v2.4.0+incompatible // indirect
|
github.com/lestrrat-go/file-rotatelogs v2.4.0+incompatible // indirect
|
||||||
github.com/mitchellh/mapstructure v1.5.0
|
github.com/mitchellh/mapstructure v1.5.0
|
||||||
github.com/openimsdk/protocol v0.0.65
|
github.com/openimsdk/protocol v0.0.65
|
||||||
github.com/openimsdk/tools v0.0.49-alpha.19
|
github.com/openimsdk/tools v0.0.49-alpha.6
|
||||||
github.com/pkg/errors v0.9.1 // indirect
|
github.com/pkg/errors v0.9.1 // indirect
|
||||||
github.com/prometheus/client_golang v1.18.0
|
github.com/prometheus/client_golang v1.18.0
|
||||||
github.com/stretchr/testify v1.9.0
|
github.com/stretchr/testify v1.9.0
|
||||||
|
4
go.sum
4
go.sum
@ -288,8 +288,8 @@ github.com/openimsdk/gomake v0.0.13 h1:xLDe/moqgWpRoptHzI4packAWzs4C16b+sVY+txNJ
|
|||||||
github.com/openimsdk/gomake v0.0.13/go.mod h1:PndCozNc2IsQIciyn9mvEblYWZwJmAI+06z94EY+csI=
|
github.com/openimsdk/gomake v0.0.13/go.mod h1:PndCozNc2IsQIciyn9mvEblYWZwJmAI+06z94EY+csI=
|
||||||
github.com/openimsdk/protocol v0.0.65 h1:SPT9qyUsFRTTKSKb/FjpS+xr6sxz/Kbnu+su1bxYagc=
|
github.com/openimsdk/protocol v0.0.65 h1:SPT9qyUsFRTTKSKb/FjpS+xr6sxz/Kbnu+su1bxYagc=
|
||||||
github.com/openimsdk/protocol v0.0.65/go.mod h1:OZQA9FR55lseYoN2Ql1XAHYKHJGu7OMNkUbuekrKCM8=
|
github.com/openimsdk/protocol v0.0.65/go.mod h1:OZQA9FR55lseYoN2Ql1XAHYKHJGu7OMNkUbuekrKCM8=
|
||||||
github.com/openimsdk/tools v0.0.49-alpha.19 h1:CbASL0yefRSVAmWPVeRnhF7wZKd6umLfz31CIhEgrBs=
|
github.com/openimsdk/tools v0.0.49-alpha.6 h1:I3HSyNWqOMTzZ1DlD0ZDKAgVzxGAFnN9EYW0xkA+8To=
|
||||||
github.com/openimsdk/tools v0.0.49-alpha.19/go.mod h1:g7mkHXYUPi0/8aAX8VPMHpnb3hqdV69Jph+bXOGvvNM=
|
github.com/openimsdk/tools v0.0.49-alpha.6/go.mod h1:g7mkHXYUPi0/8aAX8VPMHpnb3hqdV69Jph+bXOGvvNM=
|
||||||
github.com/pelletier/go-toml/v2 v2.1.0 h1:FnwAJ4oYMvbT/34k9zzHuZNrhlz48GB3/s6at6/MHO4=
|
github.com/pelletier/go-toml/v2 v2.1.0 h1:FnwAJ4oYMvbT/34k9zzHuZNrhlz48GB3/s6at6/MHO4=
|
||||||
github.com/pelletier/go-toml/v2 v2.1.0/go.mod h1:tJU2Z3ZkXwnxa4DPO899bsyIoywizdUvyaeZurnPPDc=
|
github.com/pelletier/go-toml/v2 v2.1.0/go.mod h1:tJU2Z3ZkXwnxa4DPO899bsyIoywizdUvyaeZurnPPDc=
|
||||||
github.com/pierrec/lz4/v4 v4.1.21 h1:yOVMLb6qSIDP67pl/5F7RepeKYu/VmTyEXvuMI5d9mQ=
|
github.com/pierrec/lz4/v4 v4.1.21 h1:yOVMLb6qSIDP67pl/5F7RepeKYu/VmTyEXvuMI5d9mQ=
|
||||||
|
@ -28,13 +28,14 @@ const (
|
|||||||
zookeeperConst = "zookeeper"
|
zookeeperConst = "zookeeper"
|
||||||
kubenetesConst = "k8s"
|
kubenetesConst = "k8s"
|
||||||
directConst = "direct"
|
directConst = "direct"
|
||||||
etcdConst = "etcd"
|
etcd = "etcd"
|
||||||
)
|
)
|
||||||
|
|
||||||
// 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.SvcDiscoveryRegistry, error) {
|
func NewDiscoveryRegister(zookeeperConfig *config.ZooKeeper, share *config.Share) (discovery.SvcDiscoveryRegistry1, error) {
|
||||||
switch share.Env {
|
switch share.Env {
|
||||||
case zookeeperConst:
|
case zookeeperConst:
|
||||||
|
|
||||||
return zookeeper.NewZkClient(
|
return zookeeper.NewZkClient(
|
||||||
zookeeperConfig.Address,
|
zookeeperConfig.Address,
|
||||||
zookeeperConfig.Schema,
|
zookeeperConfig.Schema,
|
||||||
@ -45,7 +46,7 @@ func NewDiscoveryRegister(zookeeperConfig *config.ZooKeeper, share *config.Share
|
|||||||
)
|
)
|
||||||
case kubenetesConst:
|
case kubenetesConst:
|
||||||
return kubernetes.NewK8sDiscoveryRegister(share.RpcRegisterName.MessageGateway)
|
return kubernetes.NewK8sDiscoveryRegister(share.RpcRegisterName.MessageGateway)
|
||||||
case etcdConst:
|
case etcd:
|
||||||
return getcd.NewSvcDiscoveryRegistry("openim", []string{"http://localhost:2379"})
|
return getcd.NewSvcDiscoveryRegistry("openim", []string{"http://localhost:2379"})
|
||||||
case directConst:
|
case directConst:
|
||||||
//return direct.NewConnDirect(config)
|
//return direct.NewConnDirect(config)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user