Merge pull request #840 from owncloud/ocis-1018

Tweak go-micro behavior
This commit is contained in:
Alex Unger
2020-11-12 13:59:12 +01:00
committed by GitHub
27 changed files with 248 additions and 71 deletions

View File

@@ -15,13 +15,13 @@ import (
"github.com/coreos/go-oidc"
"github.com/justinas/alice"
"github.com/micro/cli/v2"
mclient "github.com/micro/go-micro/v2/client"
"github.com/micro/go-micro/v2/client/grpc"
"github.com/oklog/run"
openzipkin "github.com/openzipkin/zipkin-go"
zipkinhttp "github.com/openzipkin/zipkin-go/reporter/http"
acc "github.com/owncloud/ocis/accounts/pkg/proto/v0"
"github.com/owncloud/ocis/ocis-pkg/log"
ogrpc "github.com/owncloud/ocis/ocis-pkg/service/grpc"
"github.com/owncloud/ocis/proxy/pkg/config"
"github.com/owncloud/ocis/proxy/pkg/cs3"
"github.com/owncloud/ocis/proxy/pkg/flagset"
@@ -254,10 +254,8 @@ func loadMiddlewares(ctx context.Context, l log.Logger, cfg *config.Config) alic
middleware.PreSignedURLConfig(cfg.PreSignedURL),
)
// TODO this won't work with a registry other than mdns. Look into Micro's client initialization.
// https://github.com/owncloud/ocis/proxy/issues/38
accounts := acc.NewAccountsService("com.owncloud.api.accounts", mclient.DefaultClient)
roles := settings.NewRoleService("com.owncloud.api.settings", mclient.DefaultClient)
accounts := acc.NewAccountsService("com.owncloud.api.accounts", ogrpc.DefaultClient)
roles := settings.NewRoleService("com.owncloud.api.settings", ogrpc.DefaultClient)
uuidMW := middleware.AccountUUID(
middleware.Logger(l),

View File

@@ -4,8 +4,9 @@ import (
"fmt"
"os"
"github.com/owncloud/ocis/ocis-pkg/registry"
"github.com/micro/cli/v2"
"github.com/micro/go-micro/v2/registry/mdns"
tw "github.com/olekukonko/tablewriter"
"github.com/owncloud/ocis/proxy/pkg/config"
"github.com/owncloud/ocis/proxy/pkg/flagset"
@@ -18,7 +19,7 @@ func PrintVersion(cfg *config.Config) *cli.Command {
Usage: "Print the versions of the running instances",
Flags: flagset.ListProxyWithConfig(cfg),
Action: func(c *cli.Context) error {
reg := mdns.NewRegistry()
reg := *registry.GetRegistry()
services, err := reg.GetService(cfg.Service.Namespace + "." + cfg.Service.Name)
if err != nil {
fmt.Println(fmt.Errorf("could not get proxy services from the registry: %v", err))