adjust flagsets

This commit is contained in:
A.Unger
2021-11-04 15:56:01 +01:00
parent a76ad08d12
commit da36ca8cde
10 changed files with 315 additions and 543 deletions
+12 -14
View File
@@ -8,7 +8,6 @@ import (
"github.com/oklog/run"
accounts "github.com/owncloud/ocis/accounts/pkg/proto/v0"
"github.com/owncloud/ocis/glauth/pkg/config"
"github.com/owncloud/ocis/glauth/pkg/flagset"
"github.com/owncloud/ocis/glauth/pkg/metrics"
"github.com/owncloud/ocis/glauth/pkg/server/debug"
"github.com/owncloud/ocis/glauth/pkg/server/glauth"
@@ -24,24 +23,23 @@ func Server(cfg *config.Config) *cli.Command {
return &cli.Command{
Name: "server",
Usage: "Start integrated server",
Flags: flagset.ServerWithConfig(cfg),
Before: func(ctx *cli.Context) error {
logger := NewLogger(cfg)
if cfg.HTTP.Root != "/" {
cfg.HTTP.Root = strings.TrimSuffix(cfg.HTTP.Root, "/")
}
// StringSliceFlag doesn't support Destination
// UPDATE Destination on string flags supported. Wait for https://github.com/urfave/cli/pull/1078 to get to micro/cli
if len(ctx.StringSlice("backend-server")) > 0 {
cfg.Backend.Servers = ctx.StringSlice("backend-server")
if err := ParseConfig(ctx, cfg); err != nil {
return err
}
if len(ctx.StringSlice("fallback-server")) > 0 {
cfg.Fallback.Servers = ctx.StringSlice("fallback-server")
}
if !cfg.Supervised {
return ParseConfig(ctx, cfg)
}
logger.Debug().Strs("backend-server", ctx.StringSlice("backend-server")).Str("service", "glauth").Msg("ignoring config file parsing when running supervised")
// TODO(refs) there is no cli flags anymore...
//if len(ctx.StringSlice("backend-server")) > 0 {
// cfg.Backend.Servers = ctx.StringSlice("backend-server")
//}
//if len(ctx.StringSlice("fallback-server")) > 0 {
// cfg.Fallback.Servers = ctx.StringSlice("fallback-server")
//}
return nil
},
Action: func(c *cli.Context) error {