Use micro default client for connections to account service
This commit is contained in:
@@ -17,7 +17,6 @@ import (
|
|||||||
glauthcfg "github.com/glauth/glauth/pkg/config"
|
glauthcfg "github.com/glauth/glauth/pkg/config"
|
||||||
|
|
||||||
"github.com/micro/cli/v2"
|
"github.com/micro/cli/v2"
|
||||||
"github.com/micro/go-micro/v2"
|
|
||||||
"github.com/micro/go-micro/v2/client"
|
"github.com/micro/go-micro/v2/client"
|
||||||
"github.com/oklog/run"
|
"github.com/oklog/run"
|
||||||
openzipkin "github.com/openzipkin/zipkin-go"
|
openzipkin "github.com/openzipkin/zipkin-go"
|
||||||
@@ -192,11 +191,7 @@ func Server(cfg *config.Config) *cli.Command {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
as, gs, err := getAccountsServices()
|
as, gs := getAccountsServices()
|
||||||
if err != nil {
|
|
||||||
return err
|
|
||||||
}
|
|
||||||
|
|
||||||
server, err := glauth.Server(
|
server, err := glauth.Server(
|
||||||
glauth.AccountsService(as),
|
glauth.AccountsService(as),
|
||||||
glauth.GroupsService(gs),
|
glauth.GroupsService(gs),
|
||||||
@@ -312,19 +307,7 @@ func Server(cfg *config.Config) *cli.Command {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// getAccountsServices returns an ocis-accounts service
|
// getAccountsServices returns an ocis-accounts service
|
||||||
func getAccountsServices() (accounts.AccountsService, accounts.GroupsService, error) {
|
func getAccountsServices() (accounts.AccountsService, accounts.GroupsService) {
|
||||||
service := micro.NewService()
|
return accounts.NewAccountsService("com.owncloud.api.accounts", client.DefaultClient),
|
||||||
|
accounts.NewGroupsService("com.owncloud.api.accounts", client.DefaultClient)
|
||||||
// parse command line flags
|
|
||||||
service.Init()
|
|
||||||
|
|
||||||
err := service.Client().Init(
|
|
||||||
client.ContentType("application/json"),
|
|
||||||
)
|
|
||||||
if err != nil {
|
|
||||||
return nil, nil, err
|
|
||||||
}
|
|
||||||
return accounts.NewAccountsService("com.owncloud.api.accounts", service.Client()),
|
|
||||||
accounts.NewGroupsService("com.owncloud.api.accounts", service.Client()),
|
|
||||||
nil
|
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user