Skip to content

Commit

Permalink
Merge pull request #1546 from ybr-nx/master
Browse files Browse the repository at this point in the history
Use MICRO_REGISTRY_ADDRESS env var for etcd address
  • Loading branch information
wkloucek authored Jan 29, 2021
2 parents fb8a744 + cfb6bf3 commit eb72c5d
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 13 deletions.
5 changes: 5 additions & 0 deletions changelog/unreleased/fix-etcd-address-conf.md
Original file line number Diff line number Diff line change
@@ -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
15 changes: 2 additions & 13 deletions ocis-pkg/service/grpc/service.go
Original file line number Diff line number Diff line change
@@ -1,34 +1,23 @@
package grpc

import (
"os"
"strings"
"time"

"github.com/micro/go-micro/v2"
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"
)

// DefaultClient is a custom ocis grpc configured client.
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),
Expand Down

0 comments on commit eb72c5d

Please sign in to comment.