unmarshal token to filter spaces for current user (#6596)
* unmarshal token to filter spaces for current user Signed-off-by: Jörn Friedrich Dreyer <jfd@butonic.de> * Fix tests --------- Signed-off-by: Jörn Friedrich Dreyer <jfd@butonic.de> Co-authored-by: André Duffeck <andre.duffeck@firondu.de>
This commit is contained in:
co-authored by
André Duffeck
parent
abf94f1ccb
commit
2ea3b8c400
@@ -15,13 +15,14 @@ type Option func(o *Options)
|
||||
|
||||
// Options defines the available options for this package.
|
||||
type Options struct {
|
||||
Name string
|
||||
Logger log.Logger
|
||||
Context context.Context
|
||||
Config *config.Config
|
||||
Metrics *metrics.Metrics
|
||||
Flags []cli.Flag
|
||||
Handler *svc.Service
|
||||
Name string
|
||||
Logger log.Logger
|
||||
Context context.Context
|
||||
Config *config.Config
|
||||
Metrics *metrics.Metrics
|
||||
Flags []cli.Flag
|
||||
Handler *svc.Service
|
||||
JWTSecret string
|
||||
}
|
||||
|
||||
// newOptions initializes the available default options.
|
||||
@@ -83,3 +84,10 @@ func Handler(val *svc.Service) Option {
|
||||
o.Handler = val
|
||||
}
|
||||
}
|
||||
|
||||
// JWTSecret provides a function to set the Config option.
|
||||
func JWTSecret(val string) Option {
|
||||
return func(o *Options) {
|
||||
o.JWTSecret = val
|
||||
}
|
||||
}
|
||||
|
||||
@@ -33,6 +33,7 @@ func Server(opts ...Option) (grpc.Service, func(), error) {
|
||||
handle, teardown, err := svc.NewHandler(
|
||||
svc.Config(options.Config),
|
||||
svc.Logger(options.Logger),
|
||||
svc.JWTSecret(options.JWTSecret),
|
||||
)
|
||||
if err != nil {
|
||||
options.Logger.Error().
|
||||
|
||||
Reference in New Issue
Block a user