mirror of
https://github.com/opencloud-eu/opencloud.git
synced 2026-01-06 12:19:37 -06:00
refactor registry awareness logic
This commit is contained in:
16
storage/pkg/service/external/external.go
vendored
16
storage/pkg/service/external/external.go
vendored
@@ -2,16 +2,12 @@ package external
|
||||
|
||||
import (
|
||||
"context"
|
||||
"os"
|
||||
"strings"
|
||||
"time"
|
||||
|
||||
etcdr "github.com/micro/go-micro/v2/registry/etcd"
|
||||
mdnsr "github.com/micro/go-micro/v2/registry/mdns"
|
||||
|
||||
"github.com/micro/go-micro/v2/broker"
|
||||
"github.com/micro/go-micro/v2/registry"
|
||||
"github.com/owncloud/ocis/ocis-pkg/log"
|
||||
oregistry "github.com/owncloud/ocis/ocis-pkg/registry"
|
||||
)
|
||||
|
||||
// RegisterGRPCEndpoint publishes an arbitrary endpoint to the service-registry. This allows to query nodes of
|
||||
@@ -29,15 +25,7 @@ func RegisterGRPCEndpoint(ctx context.Context, serviceID, uuid, addr string, log
|
||||
node.Metadata["transport"] = "grpc"
|
||||
node.Metadata["protocol"] = "grpc"
|
||||
|
||||
addresses := strings.Split(os.Getenv("MICRO_REGISTRY_ADDRESS"), ",")
|
||||
var r registry.Registry
|
||||
|
||||
switch os.Getenv("MICRO_REGISTRY") {
|
||||
case "etcd":
|
||||
r = etcdr.NewRegistry(registry.Addrs(addresses...))
|
||||
default:
|
||||
r = mdnsr.NewRegistry()
|
||||
}
|
||||
r := *oregistry.GetRegistry()
|
||||
|
||||
service := ®istry.Service{
|
||||
Name: serviceID,
|
||||
|
||||
Reference in New Issue
Block a user