removed all flagset packages

This commit is contained in:
A.Unger
2021-11-17 11:36:28 +01:00
parent c7a43916e4
commit f87b5bd66c
29 changed files with 55 additions and 420 deletions
+3 -2
View File
@@ -5,7 +5,6 @@ import (
"net/http"
"github.com/owncloud/ocis/idp/pkg/config"
"github.com/owncloud/ocis/idp/pkg/flagset"
"github.com/urfave/cli/v2"
)
@@ -14,7 +13,9 @@ func Health(cfg *config.Config) *cli.Command {
return &cli.Command{
Name: "health",
Usage: "Check health status",
Flags: flagset.HealthWithConfig(cfg),
Before: func(c *cli.Context) error {
return ParseConfig(c, cfg)
},
Action: func(c *cli.Context) error {
logger := NewLogger(cfg)
+4 -16
View File
@@ -20,26 +20,14 @@ func Server(cfg *config.Config) *cli.Command {
Name: "server",
Usage: "Start integrated server",
Before: func(ctx *cli.Context) error {
if cfg.HTTP.Root != "/" {
cfg.HTTP.Root = strings.TrimSuffix(cfg.HTTP.Root, "/")
}
//if len(ctx.StringSlice("trusted-proxy")) > 0 {
// cfg.IDP.TrustedProxy = ctx.StringSlice("trusted-proxy")
//}
//
//if len(ctx.StringSlice("allow-scope")) > 0 {
// cfg.IDP.AllowScope = ctx.StringSlice("allow-scope")
//}
//
//if len(ctx.StringSlice("signing-private-key")) > 0 {
// cfg.IDP.SigningPrivateKeyFiles = ctx.StringSlice("signing-private-key")
//}
if err := ParseConfig(ctx, cfg); err != nil {
return err
}
if cfg.HTTP.Root != "/" {
cfg.HTTP.Root = strings.TrimSuffix(cfg.HTTP.Root, "/")
}
return nil
},
Action: func(c *cli.Context) error {
+3 -2
View File
@@ -8,7 +8,6 @@ import (
tw "github.com/olekukonko/tablewriter"
"github.com/owncloud/ocis/idp/pkg/config"
"github.com/owncloud/ocis/idp/pkg/flagset"
"github.com/urfave/cli/v2"
)
@@ -17,7 +16,9 @@ func PrintVersion(cfg *config.Config) *cli.Command {
return &cli.Command{
Name: "version",
Usage: "Print the versions of the running instances",
Flags: flagset.ListIDPWithConfig(cfg),
Before: func(c *cli.Context) error {
return ParseConfig(c, cfg)
},
Action: func(c *cli.Context) error {
reg := registry.GetRegistry()
services, err := reg.GetService(cfg.Service.Namespace + "." + cfg.Service.Name)
-39
View File
@@ -1,39 +0,0 @@
package flagset
import (
"github.com/owncloud/ocis/idp/pkg/config"
"github.com/owncloud/ocis/ocis-pkg/flags"
"github.com/urfave/cli/v2"
)
// HealthWithConfig applies cfg to the root flagset
func HealthWithConfig(cfg *config.Config) []cli.Flag {
return []cli.Flag{
&cli.StringFlag{
Name: "debug-addr",
Value: flags.OverrideDefaultString(cfg.Debug.Addr, "127.0.0.1:9134"),
Usage: "Address to debug endpoint",
EnvVars: []string{"IDP_DEBUG_ADDR"},
Destination: &cfg.Debug.Addr,
},
}
}
// ListIDPWithConfig applies the config to the list commands flags
func ListIDPWithConfig(cfg *config.Config) []cli.Flag {
return []cli.Flag{&cli.StringFlag{
Name: "http-namespace",
Value: flags.OverrideDefaultString(cfg.Service.Namespace, "com.owncloud.web"),
Usage: "Set the base namespace for service discovery",
EnvVars: []string{"IDP_HTTP_NAMESPACE"},
Destination: &cfg.Service.Namespace,
},
&cli.StringFlag{
Name: "name",
Value: flags.OverrideDefaultString(cfg.Service.Name, "idp"),
Usage: "Service name",
EnvVars: []string{"IDP_NAME"},
Destination: &cfg.Service.Name,
},
}
}