add store to new config scheme

This commit is contained in:
A.Unger
2021-03-12 17:03:43 +01:00
parent f77d4eb67a
commit dff486a737
+13 -12
View File
@@ -2,6 +2,7 @@ package flagset
import ( import (
"github.com/micro/cli/v2" "github.com/micro/cli/v2"
"github.com/owncloud/ocis/ocis-pkg/flags"
"github.com/owncloud/ocis/store/pkg/config" "github.com/owncloud/ocis/store/pkg/config"
) )
@@ -41,7 +42,7 @@ func HealthWithConfig(cfg *config.Config) []cli.Flag {
return []cli.Flag{ return []cli.Flag{
&cli.StringFlag{ &cli.StringFlag{
Name: "debug-addr", Name: "debug-addr",
Value: "0.0.0.0:9460", Value: flags.OverrideDefaultString(cfg.Debug.Addr, "0.0.0.0:9460"),
Usage: "Address to debug endpoint", Usage: "Address to debug endpoint",
EnvVars: []string{"STORE_DEBUG_ADDR"}, EnvVars: []string{"STORE_DEBUG_ADDR"},
Destination: &cfg.Debug.Addr, Destination: &cfg.Debug.Addr,
@@ -60,42 +61,42 @@ func ServerWithConfig(cfg *config.Config) []cli.Flag {
}, },
&cli.StringFlag{ &cli.StringFlag{
Name: "tracing-type", Name: "tracing-type",
Value: "jaeger", Value: flags.OverrideDefaultString(cfg.Tracing.Type, "jaeger"),
Usage: "Tracing backend type", Usage: "Tracing backend type",
EnvVars: []string{"STORE_TRACING_TYPE"}, EnvVars: []string{"STORE_TRACING_TYPE"},
Destination: &cfg.Tracing.Type, Destination: &cfg.Tracing.Type,
}, },
&cli.StringFlag{ &cli.StringFlag{
Name: "tracing-endpoint", Name: "tracing-endpoint",
Value: "", Value: flags.OverrideDefaultString(cfg.Tracing.Endpoint, ""),
Usage: "Endpoint for the agent", Usage: "Endpoint for the agent",
EnvVars: []string{"STORE_TRACING_ENDPOINT"}, EnvVars: []string{"STORE_TRACING_ENDPOINT"},
Destination: &cfg.Tracing.Endpoint, Destination: &cfg.Tracing.Endpoint,
}, },
&cli.StringFlag{ &cli.StringFlag{
Name: "tracing-collector", Name: "tracing-collector",
Value: "", Value: flags.OverrideDefaultString(cfg.Tracing.Collector, ""),
Usage: "Endpoint for the collector", Usage: "Endpoint for the collector",
EnvVars: []string{"STORE_TRACING_COLLECTOR"}, EnvVars: []string{"STORE_TRACING_COLLECTOR"},
Destination: &cfg.Tracing.Collector, Destination: &cfg.Tracing.Collector,
}, },
&cli.StringFlag{ &cli.StringFlag{
Name: "tracing-service", Name: "tracing-service",
Value: "store", Value: flags.OverrideDefaultString(cfg.Tracing.Service, "store"),
Usage: "Service name for tracing", Usage: "Service name for tracing",
EnvVars: []string{"STORE_TRACING_SERVICE"}, EnvVars: []string{"STORE_TRACING_SERVICE"},
Destination: &cfg.Tracing.Service, Destination: &cfg.Tracing.Service,
}, },
&cli.StringFlag{ &cli.StringFlag{
Name: "debug-addr", Name: "debug-addr",
Value: "0.0.0.0:9460", Value: flags.OverrideDefaultString(cfg.Debug.Addr, "0.0.0.0:9460"),
Usage: "Address to bind debug server", Usage: "Address to bind debug server",
EnvVars: []string{"STORE_DEBUG_ADDR"}, EnvVars: []string{"STORE_DEBUG_ADDR"},
Destination: &cfg.Debug.Addr, Destination: &cfg.Debug.Addr,
}, },
&cli.StringFlag{ &cli.StringFlag{
Name: "debug-token", Name: "debug-token",
Value: "", Value: flags.OverrideDefaultString(cfg.Debug.Token, ""),
Usage: "Token to grant metrics access", Usage: "Token to grant metrics access",
EnvVars: []string{"STORE_DEBUG_TOKEN"}, EnvVars: []string{"STORE_DEBUG_TOKEN"},
Destination: &cfg.Debug.Token, Destination: &cfg.Debug.Token,
@@ -114,21 +115,21 @@ func ServerWithConfig(cfg *config.Config) []cli.Flag {
}, },
&cli.StringFlag{ &cli.StringFlag{
Name: "grpc-namespace", Name: "grpc-namespace",
Value: "com.owncloud.api", Value: flags.OverrideDefaultString(cfg.Service.Namespace, "com.owncloud.api"),
Usage: "Set the base namespace for the grpc namespace", Usage: "Set the base namespace for the grpc namespace",
EnvVars: []string{"STORE_GRPC_NAMESPACE"}, EnvVars: []string{"STORE_GRPC_NAMESPACE"},
Destination: &cfg.Service.Namespace, Destination: &cfg.Service.Namespace,
}, },
&cli.StringFlag{ &cli.StringFlag{
Name: "name", Name: "name",
Value: "store", Value: flags.OverrideDefaultString(cfg.Service.Name, "store"),
Usage: "Service name", Usage: "Service name",
EnvVars: []string{"STORE_NAME"}, EnvVars: []string{"STORE_NAME"},
Destination: &cfg.Service.Name, Destination: &cfg.Service.Name,
}, },
&cli.StringFlag{ &cli.StringFlag{
Name: "data-path", Name: "data-path",
Value: "/var/tmp/ocis/store", Value: flags.OverrideDefaultString(cfg.Datapath, "/var/tmp/ocis/store"),
Usage: "location of the store data path", Usage: "location of the store data path",
EnvVars: []string{"STORE_DATA_PATH"}, EnvVars: []string{"STORE_DATA_PATH"},
Destination: &cfg.Datapath, Destination: &cfg.Datapath,
@@ -140,14 +141,14 @@ func ServerWithConfig(cfg *config.Config) []cli.Flag {
func ListStoreWithConfig(cfg *config.Config) []cli.Flag { func ListStoreWithConfig(cfg *config.Config) []cli.Flag {
return []cli.Flag{&cli.StringFlag{ return []cli.Flag{&cli.StringFlag{
Name: "grpc-namespace", Name: "grpc-namespace",
Value: "com.owncloud.api", Value: flags.OverrideDefaultString(cfg.Service.Namespace, "com.owncloud.api"),
Usage: "Set the base namespace for the grpc namespace", Usage: "Set the base namespace for the grpc namespace",
EnvVars: []string{"STORE_GRPC_NAMESPACE"}, EnvVars: []string{"STORE_GRPC_NAMESPACE"},
Destination: &cfg.Service.Namespace, Destination: &cfg.Service.Namespace,
}, },
&cli.StringFlag{ &cli.StringFlag{
Name: "name", Name: "name",
Value: "store", Value: flags.OverrideDefaultString(cfg.Service.Name, "store"),
Usage: "Service name", Usage: "Service name",
EnvVars: []string{"STORE_NAME"}, EnvVars: []string{"STORE_NAME"},
Destination: &cfg.Service.Name, Destination: &cfg.Service.Name,