mirror of
https://github.com/opencloud-eu/opencloud.git
synced 2026-03-14 13:18:58 -04:00
Sync with ocis-hello flags handling (#20)
Sync with ocis-hello flags handling
This commit is contained in:
1
go.sum
1
go.sum
@@ -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=
|
||||
|
||||
@@ -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 {
|
||||
|
||||
@@ -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...)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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(
|
||||
|
||||
Reference in New Issue
Block a user