bring back etcd registry
Signed-off-by: Jörn Friedrich Dreyer <jfd@butonic.de>
This commit is contained in:
+5
-1
@@ -40,5 +40,9 @@ replace (
|
||||
github.com/owncloud/ocis/accounts => ../accounts
|
||||
github.com/owncloud/ocis/settings => ../settings
|
||||
github.com/owncloud/ocis/storage => ../storage
|
||||
google.golang.org/grpc => google.golang.org/grpc v1.26.0
|
||||
// taken from https://github.com/asim/go-micro/blob/master/plugins/registry/etcd/go.mod#L14-L16
|
||||
go.etcd.io/etcd/api/v3 => go.etcd.io/etcd/api/v3 v3.0.0-20210204162551-dae29bb719dd
|
||||
go.etcd.io/etcd/pkg/v3 => go.etcd.io/etcd/pkg/v3 v3.0.0-20210204162551-dae29bb719dd
|
||||
// latest version compatible with etcd
|
||||
google.golang.org/grpc => google.golang.org/grpc v1.29.1
|
||||
)
|
||||
|
||||
@@ -2,8 +2,9 @@ package registry
|
||||
|
||||
import (
|
||||
"os"
|
||||
"strings"
|
||||
|
||||
//etcdr "github.com/asim/go-micro/plugins/registry/etcd/v3"
|
||||
etcdr "github.com/asim/go-micro/plugins/registry/etcd/v3"
|
||||
mdnsr "github.com/asim/go-micro/plugins/registry/mdns/v3"
|
||||
|
||||
"github.com/asim/go-micro/v3/registry"
|
||||
@@ -18,14 +19,14 @@ var (
|
||||
// It defaults to mDNS, so mind that systems with mDNS disabled by default (i.e SUSE) will have a hard time
|
||||
// and it needs to explicitly use etcd. Os awareness for providing a working registry out of the box should be done.
|
||||
func GetRegistry() *registry.Registry {
|
||||
//addresses := strings.Split(os.Getenv(registryAddressEnv), ",")
|
||||
addresses := strings.Split(os.Getenv(registryAddressEnv), ",")
|
||||
|
||||
var r registry.Registry
|
||||
switch os.Getenv(registryEnv) {
|
||||
//case "etcd":
|
||||
// r = etcdr.NewRegistry(
|
||||
// registry.Addrs(addresses...),
|
||||
// )
|
||||
case "etcd":
|
||||
r = etcdr.NewRegistry(
|
||||
registry.Addrs(addresses...),
|
||||
)
|
||||
default:
|
||||
r = mdnsr.NewRegistry()
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user