use less selectors
Signed-off-by: Jörn Friedrich Dreyer <jfd@butonic.de>
This commit is contained in:
@@ -15,13 +15,11 @@ import (
|
||||
"github.com/cs3org/reva/v2/pkg/rgrpc/todo/pool"
|
||||
utils "github.com/cs3org/reva/v2/pkg/utils"
|
||||
libregraph "github.com/owncloud/libre-graph-api-go"
|
||||
"go-micro.dev/v4/selector"
|
||||
|
||||
"github.com/owncloud/ocis/v2/ocis-pkg/log"
|
||||
"github.com/owncloud/ocis/v2/ocis-pkg/oidc"
|
||||
"github.com/owncloud/ocis/v2/ocis-pkg/registry"
|
||||
"github.com/owncloud/ocis/v2/services/graph/pkg/errorcode"
|
||||
"github.com/owncloud/ocis/v2/services/proxy/pkg/config"
|
||||
"go-micro.dev/v4/selector"
|
||||
)
|
||||
|
||||
type cs3backend struct {
|
||||
@@ -36,6 +34,7 @@ type Option func(o *Options)
|
||||
type Options struct {
|
||||
logger log.Logger
|
||||
gatewaySelector pool.Selectable[gateway.GatewayAPIClient]
|
||||
selector selector.Selector
|
||||
machineAuthAPIKey string
|
||||
oidcISS string
|
||||
serviceAccount config.ServiceAccount
|
||||
@@ -60,6 +59,13 @@ func WithRevaGatewaySelector(selectable pool.Selectable[gateway.GatewayAPIClient
|
||||
}
|
||||
}
|
||||
|
||||
// WithSelector set the Selector option
|
||||
func WithSelector(selector selector.Selector) Option {
|
||||
return func(o *Options) {
|
||||
o.selector = selector
|
||||
}
|
||||
}
|
||||
|
||||
// WithMachineAuthAPIKey configures the machine auth API key
|
||||
func WithMachineAuthAPIKey(ma string) Option {
|
||||
return func(o *Options) {
|
||||
@@ -94,12 +100,9 @@ func NewCS3UserBackend(opts ...Option) UserBackend {
|
||||
o(&opt)
|
||||
}
|
||||
|
||||
reg := registry.GetRegistry()
|
||||
sel := selector.NewSelector(selector.Registry(reg))
|
||||
|
||||
b := cs3backend{
|
||||
Options: opt,
|
||||
graphSelector: sel,
|
||||
graphSelector: opt.selector,
|
||||
}
|
||||
|
||||
return &b
|
||||
|
||||
Reference in New Issue
Block a user