Sync with ocis-hello flags handling (#20)

Sync with ocis-hello flags handling
This commit is contained in:
Alex Unger
2019-12-11 16:18:16 +01:00
committed by GitHub
4 changed files with 14 additions and 5 deletions

1
go.sum
View File

@@ -678,6 +678,7 @@ go.uber.org/multierr v1.3.0 h1:sFPn2GLc3poCkfrpIXGhBD2X0CMIo4Q/zSULXrj/+uc=
go.uber.org/multierr v1.3.0/go.mod h1:VgVr7evmIr6uPjLBxg28wmKNXyqE9akIJ5XnfpiKl+4=
go.uber.org/ratelimit v0.0.0-20180316092928-c15da0234277/go.mod h1:2X8KaoNd1J0lZV+PxJk/5+DGbO/tpwLR1m++a7FnB/Y=
go.uber.org/ratelimit v0.1.0/go.mod h1:2X8KaoNd1J0lZV+PxJk/5+DGbO/tpwLR1m++a7FnB/Y=
go.uber.org/tools v0.0.0-20190618225709-2cfd321de3ee h1:0mgffUl7nfd+FpvXMVz4IDEaUSmT1ysygQC7qYo7sG4=
go.uber.org/tools v0.0.0-20190618225709-2cfd321de3ee/go.mod h1:vJERXedbb3MVM5f9Ejo0C68/HhF8uaILCdgjnY+goOA=
go.uber.org/zap v1.10.0/go.mod h1:vwi/ZaCAaUcBkycHslxD9B2zi4UTXhF60s6SWpuDF0Q=
go.uber.org/zap v1.12.0 h1:dySoUQPFBGj6xwjmBzageVL8jGi8uxc6bEmJQjA06bw=

View File

@@ -137,6 +137,8 @@ func Server(cfg *config.Config) cli.Command {
http.Context(ctx),
http.Config(cfg),
http.Metrics(metrics),
http.Flags(flagset.RootWithConfig(cfg)),
http.Flags(flagset.ServerWithConfig(cfg)),
)
if err != nil {

View File

@@ -3,6 +3,7 @@ package http
import (
"context"
"github.com/micro/cli"
"github.com/owncloud/ocis-graph/pkg/config"
"github.com/owncloud/ocis-graph/pkg/metrics"
"github.com/owncloud/ocis-pkg/log"
@@ -17,6 +18,7 @@ type Options struct {
Context context.Context
Config *config.Config
Metrics *metrics.Metrics
Flags []cli.Flag
}
// newOptions initializes the available default options.
@@ -57,3 +59,10 @@ func Metrics(val *metrics.Metrics) Option {
o.Metrics = val
}
}
// Flags provides a function to set the flags option.
func Flags(val []cli.Flag) Option {
return func(o *Options) {
o.Flags = append(o.Flags, val...)
}
}

View File

@@ -1,9 +1,7 @@
package http
import (
"github.com/owncloud/ocis-graph/pkg/config"
"github.com/owncloud/ocis-graph/pkg/flagset"
"github.com/owncloud/ocis-graph/pkg/service/v0"
svc "github.com/owncloud/ocis-graph/pkg/service/v0"
"github.com/owncloud/ocis-graph/pkg/version"
"github.com/owncloud/ocis-pkg/middleware"
"github.com/owncloud/ocis-pkg/service/http"
@@ -20,8 +18,7 @@ func Server(opts ...Option) (http.Service, error) {
http.Version(version.String),
http.Address(options.Config.HTTP.Addr),
http.Context(options.Context),
http.Flags(flagset.RootWithConfig(config.New())...),
http.Flags(flagset.ServerWithConfig(config.New())...),
http.Flags(options.Flags...),
)
handle := svc.NewService(