add webdav to new config scheme

This commit is contained in:
A.Unger
2021-03-12 17:14:59 +01:00
parent 26f333dece
commit 2d5107fda3
+14 -13
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/webdav/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:9119",
Value: flags.OverrideDefaultString(cfg.Debug.Addr, "0.0.0.0:9119"),
Usage: "Address to debug endpoint",
EnvVars: []string{"WEBDAV_DEBUG_ADDR"},
Destination: &cfg.Debug.Addr,
@@ -54,42 +55,42 @@ func ServerWithConfig(cfg *config.Config) []cli.Flag {
},
&cli.StringFlag{
Name: "tracing-type",
Value: "jaeger",
Value: flags.OverrideDefaultString(cfg.Tracing.Type, "jaeger"),
Usage: "Tracing backend type",
EnvVars: []string{"WEBDAV_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{"WEBDAV_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{"WEBDAV_TRACING_COLLECTOR"},
Destination: &cfg.Tracing.Collector,
},
&cli.StringFlag{
Name: "tracing-service",
Value: "webdav",
Value: flags.OverrideDefaultString(cfg.Tracing.Service, "webdav"),
Usage: "Service name for tracing",
EnvVars: []string{"WEBDAV_TRACING_SERVICE"},
Destination: &cfg.Tracing.Service,
},
&cli.StringFlag{
Name: "debug-addr",
Value: "0.0.0.0:9119",
Value: flags.OverrideDefaultString(cfg.Debug.Addr, "0.0.0.0:9119"),
Usage: "Address to bind debug server",
EnvVars: []string{"WEBDAV_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{"WEBDAV_DEBUG_TOKEN"},
Destination: &cfg.Debug.Token,
@@ -108,28 +109,28 @@ func ServerWithConfig(cfg *config.Config) []cli.Flag {
},
&cli.StringFlag{
Name: "http-addr",
Value: "0.0.0.0:9115",
Value: flags.OverrideDefaultString(cfg.HTTP.Addr, "0.0.0.0:9115"),
Usage: "Address to bind http server",
EnvVars: []string{"WEBDAV_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 service discovery",
EnvVars: []string{"WEBDAV_HTTP_NAMESPACE"},
Destination: &cfg.Service.Namespace,
},
&cli.StringFlag{
Name: "service-name",
Value: "webdav",
Value: flags.OverrideDefaultString(cfg.Service.Name, "webdav"),
Usage: "Service name",
EnvVars: []string{"WEBDAV_SERVICE_NAME"},
Destination: &cfg.Service.Name,
},
&cli.StringFlag{
Name: "http-root",
Value: "/",
Value: flags.OverrideDefaultString(cfg.HTTP.Root, "/"),
Usage: "Root path of http server",
EnvVars: []string{"WEBDAV_HTTP_ROOT"},
Destination: &cfg.HTTP.Root,
@@ -142,14 +143,14 @@ func ListWebdavWithConfig(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 service discovery",
EnvVars: []string{"WEBDAV_HTTP_NAMESPACE"},
Destination: &cfg.Service.Namespace,
},
&cli.StringFlag{
Name: "service-name",
Value: "webdav",
Value: flags.OverrideDefaultString(cfg.Service.Name, "webdav"),
Usage: "Service name",
EnvVars: []string{"WEBDAV_SERVICE_NAME"},
Destination: &cfg.Service.Name,