fix program flags

This commit is contained in:
David Christofas
2020-04-21 10:58:27 +02:00
parent 3d26974593
commit 0b757c8713
9 changed files with 133 additions and 51 deletions
+9
View File
@@ -3,6 +3,7 @@ package grpc
import (
"context"
"github.com/micro/cli/v2"
"github.com/owncloud/ocis-pkg/v2/log"
"github.com/owncloud/ocis-thumbnails/pkg/config"
"github.com/owncloud/ocis-thumbnails/pkg/metrics"
@@ -20,6 +21,7 @@ type Options struct {
Config *config.Config
Metrics *metrics.Metrics
Namespace string
Flags []cli.Flag
}
// newOptions initializes the available default options.
@@ -81,3 +83,10 @@ func Namespace(val string) Option {
o.Namespace = val
}
}
// Flags provides a function to set the flags option.
func Flags(flags []cli.Flag) Option {
return func(o *Options) {
o.Flags = append(o.Flags, flags...)
}
}
+1
View File
@@ -18,6 +18,7 @@ func NewService(opts ...Option) grpc.Service {
grpc.Version(version.String),
grpc.Address(options.Address),
grpc.Context(options.Context),
grpc.Flags(options.Flags...),
)
var thumbnail proto.ThumbnailServiceHandler