Skip to content

Commit

Permalink
allow passing registry to use
Browse files Browse the repository at this point in the history
Signed-off-by: Jörn Friedrich Dreyer <jfd@butonic.de>
  • Loading branch information
butonic committed Sep 12, 2024
1 parent dc5a8dd commit 06455e8
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 0 deletions.
9 changes: 9 additions & 0 deletions pkg/micro/ocdav/option.go
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ import (
"github.com/cs3org/reva/v2/pkg/storage/favorite"
"github.com/rs/zerolog"
"go-micro.dev/v4/broker"
"go-micro.dev/v4/registry"
"go.opentelemetry.io/otel/trace"
"google.golang.org/grpc/credentials"
)
Expand Down Expand Up @@ -74,6 +75,7 @@ type Options struct {

RegisterTTL time.Duration
RegisterInterval time.Duration
Registry registry.Registry
}

// newOptions initializes the available default options.
Expand Down Expand Up @@ -401,3 +403,10 @@ func RegisterInterval(interval time.Duration) Option {
o.RegisterInterval = interval
}
}

// Registry provides a function to set the Registry option.
func Registry(registry registry.Registry) Option {
return func(o *Options) {
o.Registry = registry
}
}
1 change: 1 addition & 0 deletions pkg/micro/ocdav/service.go
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,7 @@ func Service(opts ...Option) (micro.Service, error) {
server.Version(sopts.config.VersionString),
server.RegisterTTL(sopts.RegisterTTL),
server.RegisterInterval(sopts.RegisterInterval),
server.Registry(sopts.Registry),
)

revaService, err := ocdav.NewWith(&sopts.config, sopts.FavoriteManager, sopts.lockSystem, &sopts.Logger, sopts.GatewaySelector)
Expand Down

0 comments on commit 06455e8

Please sign in to comment.