add ocs to new config scheme

This commit is contained in:
A.Unger
2021-03-12 16:51:28 +01:00
parent 49f7266d6e
commit e132be0db6
8 changed files with 37 additions and 15 deletions

View File

@@ -2,6 +2,7 @@ package flagset
import (
"github.com/micro/cli/v2"
"github.com/owncloud/ocis/ocis-pkg/flags"
"github.com/owncloud/ocis/ocs/pkg/config"
)
@@ -10,7 +11,7 @@ func HealthWithConfig(cfg *config.Config) []cli.Flag {
return []cli.Flag{
&cli.StringFlag{
Name: "debug-addr",
Value: "0.0.0.0:9114",
Value: flags.OverrideDefaultString(cfg.Debug.Addr, "0.0.0.0:9114"),
Usage: "Address to debug endpoint",
EnvVars: []string{"OCS_DEBUG_ADDR"},
Destination: &cfg.Debug.Addr,
@@ -48,49 +49,49 @@ func ServerWithConfig(cfg *config.Config) []cli.Flag {
},
&cli.BoolFlag{
Name: "tracing-enabled",
Value: false,
Value: flags.OverrideDefaultBool(cfg.Tracing.Enabled, false),
Usage: "Enable sending traces",
EnvVars: []string{"OCS_TRACING_ENABLED"},
Destination: &cfg.Tracing.Enabled,
},
&cli.StringFlag{
Name: "tracing-type",
Value: "jaeger",
Value: flags.OverrideDefaultString(cfg.Tracing.Type, "jaeger"),
Usage: "Tracing backend type",
EnvVars: []string{"OCS_TRACING_TYPE"},
Destination: &cfg.Tracing.Type,
},
&cli.StringFlag{
Name: "tracing-endpoint",
Value: "",
Value: flags.OverrideDefaultString(cfg.Tracing.Endpoint, ""),
Usage: "Endpoint for the agent",
EnvVars: []string{"OCS_TRACING_ENDPOINT"},
Destination: &cfg.Tracing.Endpoint,
},
&cli.StringFlag{
Name: "tracing-collector",
Value: "",
Value: flags.OverrideDefaultString(cfg.Tracing.Collector, ""),
Usage: "Endpoint for the collector",
EnvVars: []string{"OCS_TRACING_COLLECTOR"},
Destination: &cfg.Tracing.Collector,
},
&cli.StringFlag{
Name: "tracing-service",
Value: "ocs",
Value: flags.OverrideDefaultString(cfg.Tracing.Service, "ocs"),
Usage: "Service name for tracing",
EnvVars: []string{"OCS_TRACING_SERVICE"},
Destination: &cfg.Tracing.Service,
},
&cli.StringFlag{
Name: "debug-addr",
Value: "0.0.0.0:9114",
Value: flags.OverrideDefaultString(cfg.Debug.Addr, "0.0.0.0:9114"),
Usage: "Address to bind debug server",
EnvVars: []string{"OCS_DEBUG_ADDR"},
Destination: &cfg.Debug.Addr,
},
&cli.StringFlag{
Name: "debug-token",
Value: "",
Value: flags.OverrideDefaultString(cfg.Debug.Token, ""),
Usage: "Token to grant metrics access",
EnvVars: []string{"OCS_DEBUG_TOKEN"},
Destination: &cfg.Debug.Token,
@@ -109,28 +110,28 @@ func ServerWithConfig(cfg *config.Config) []cli.Flag {
},
&cli.StringFlag{
Name: "http-addr",
Value: "0.0.0.0:9110",
Value: flags.OverrideDefaultString(cfg.HTTP.Addr, "0.0.0.0:9110"),
Usage: "Address to bind http server",
EnvVars: []string{"OCS_HTTP_ADDR"},
Destination: &cfg.HTTP.Addr,
},
&cli.StringFlag{
Name: "http-namespace",
Value: "com.owncloud.web",
Value: flags.OverrideDefaultString(cfg.Service.Namespace, "com.owncloud.web"),
Usage: "Set the base namespace for the http namespace",
EnvVars: []string{"OCS_NAMESPACE"},
Destination: &cfg.Service.Namespace,
},
&cli.StringFlag{
Name: "name",
Value: "ocs",
Value: flags.OverrideDefaultString(cfg.Service.Name, "ocs"),
Usage: "Service name",
EnvVars: []string{"OCS_NAME"},
Destination: &cfg.Service.Name,
},
&cli.StringFlag{
Name: "http-root",
Value: "/ocs",
Value: flags.OverrideDefaultString(cfg.HTTP.Root, "/ocs"),
Usage: "Root path of http server",
EnvVars: []string{"OCS_HTTP_ROOT"},
Destination: &cfg.HTTP.Root,
@@ -138,7 +139,7 @@ func ServerWithConfig(cfg *config.Config) []cli.Flag {
&cli.StringFlag{
Name: "jwt-secret",
Value: "Pive-Fumkiu4",
Value: flags.OverrideDefaultString(cfg.TokenManager.JWTSecret, "Pive-Fumkiu4"),
Usage: "Used to dismantle the access token, should equal reva's jwt-secret",
EnvVars: []string{"OCS_JWT_SECRET", "OCIS_JWT_SECRET"},
Destination: &cfg.TokenManager.JWTSecret,
@@ -151,14 +152,14 @@ func ListOcsWithConfig(cfg *config.Config) []cli.Flag {
return []cli.Flag{
&cli.StringFlag{
Name: "http-namespace",
Value: "com.owncloud.web",
Value: flags.OverrideDefaultString(cfg.Service.Namespace, "com.owncloud.web"),
Usage: "Set the base namespace for the http namespace",
EnvVars: []string{"OCS_NAMESPACE"},
Destination: &cfg.Service.Namespace,
},
&cli.StringFlag{
Name: "name",
Value: "ocs",
Value: flags.OverrideDefaultString(cfg.Service.Name, "ocs"),
Usage: "Service name",
EnvVars: []string{"OCS_NAME"},
Destination: &cfg.Service.Name,