diff --git a/changelog/unreleased/fix-etcd-address-conf.md b/changelog/unreleased/fix-etcd-address-conf.md new file mode 100644 index 00000000000..2b80eeda5d8 --- /dev/null +++ b/changelog/unreleased/fix-etcd-address-conf.md @@ -0,0 +1,5 @@ +Bugfix: Fix etcd address configuration + +The etcd server address in `MICRO_REGISTRY_ADDRESS` was not picked up when etcd was set as service discovery registry `MICRO_REGISTRY=etcd`. Therefore etcd was only working if available on localhost / 127.0.0.1. + +https://github.com/owncloud/ocis/pull/1546 \ No newline at end of file diff --git a/ocis-pkg/service/grpc/service.go b/ocis-pkg/service/grpc/service.go index 522c91399c3..c520330de54 100644 --- a/ocis-pkg/service/grpc/service.go +++ b/ocis-pkg/service/grpc/service.go @@ -1,7 +1,6 @@ package grpc import ( - "os" "strings" "time" @@ -9,12 +8,8 @@ import ( mclient "github.com/micro/go-micro/v2/client" "github.com/micro/go-micro/v2/client/grpc" - etcdr "github.com/micro/go-micro/v2/registry/etcd" - mdnsr "github.com/micro/go-micro/v2/registry/mdns" - - "github.com/micro/go-micro/v2/registry" - "github.com/micro/go-plugins/wrapper/trace/opencensus/v2" + "github.com/owncloud/ocis/ocis-pkg/registry" "github.com/owncloud/ocis/ocis-pkg/wrapper/prometheus" ) @@ -22,13 +17,7 @@ import ( var DefaultClient = newGrpcClient() func newGrpcClient() mclient.Client { - var r registry.Registry - switch os.Getenv("MICRO_REGISTRY") { - case "etcd": - r = etcdr.NewRegistry() - default: - r = mdnsr.NewRegistry() - } + r := *registry.GetRegistry() c := grpc.NewClient( mclient.RequestTimeout(10*time.Second),