fix graph and graph-explorer

Signed-off-by: Jörn Friedrich Dreyer <jfd@butonic.de>
This commit is contained in:
Jörn Friedrich Dreyer
2021-03-15 15:17:29 +00:00
parent 5594c142dd
commit 9fa77a27ba
18 changed files with 254 additions and 200 deletions
+15 -17
View File
@@ -3,6 +3,7 @@ package flagset
import (
"github.com/micro/cli/v2"
"github.com/owncloud/ocis/graph-explorer/pkg/config"
"github.com/owncloud/ocis/ocis-pkg/flags"
)
// RootWithConfig applies cfg to the root flagset
@@ -10,20 +11,17 @@ func RootWithConfig(cfg *config.Config) []cli.Flag {
return []cli.Flag{
&cli.StringFlag{
Name: "log-level",
Value: "info",
Usage: "Set logging level",
EnvVars: []string{"GRAPH_EXPLORER_LOG_LEVEL"},
Destination: &cfg.Log.Level,
},
&cli.BoolFlag{
Value: true,
Name: "log-pretty",
Usage: "Enable pretty logging",
EnvVars: []string{"GRAPH_EXPLORER_LOG_PRETTY"},
Destination: &cfg.Log.Pretty,
},
&cli.BoolFlag{
Value: true,
Name: "log-color",
Usage: "Enable colored logging",
EnvVars: []string{"GRAPH_EXPLORER_LOG_COLOR"},
@@ -37,7 +35,7 @@ func HealthWithConfig(cfg *config.Config) []cli.Flag {
return []cli.Flag{
&cli.StringFlag{
Name: "debug-addr",
Value: "0.0.0.0:9136",
Value: flags.OverrideDefaultString(cfg.Debug.Addr, "0.0.0.0:9136"),
Usage: "Address to debug endpoint",
EnvVars: []string{"GRAPH_EXPLORER_DEBUG_ADDR"},
Destination: &cfg.Debug.Addr,
@@ -56,42 +54,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{"GRAPH_EXPLORER_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{"GRAPH_EXPLORER_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{"GRAPH_EXPLORER_TRACING_COLLECTOR"},
Destination: &cfg.Tracing.Collector,
},
&cli.StringFlag{
Name: "tracing-service",
Value: "graph-explorer",
Value: flags.OverrideDefaultString(cfg.Tracing.Service, "graph-explorer"),
Usage: "Service name for tracing",
EnvVars: []string{"GRAPH_EXPLORER_TRACING_SERVICE"},
Destination: &cfg.Tracing.Service,
},
&cli.StringFlag{
Name: "debug-addr",
Value: "0.0.0.0:9136",
Value: flags.OverrideDefaultString(cfg.Debug.Addr, "0.0.0.0:9136"),
Usage: "Address to bind debug server",
EnvVars: []string{"GRAPH_EXPLORER_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{"GRAPH_EXPLORER_DEBUG_TOKEN"},
Destination: &cfg.Debug.Token,
@@ -110,42 +108,42 @@ func ServerWithConfig(cfg *config.Config) []cli.Flag {
},
&cli.StringFlag{
Name: "http-addr",
Value: "0.0.0.0:9135",
Value: flags.OverrideDefaultString(cfg.HTTP.Addr, "0.0.0.0:9135"),
Usage: "Address to bind http server",
EnvVars: []string{"GRAPH_EXPLORER_HTTP_ADDR"},
Destination: &cfg.HTTP.Addr,
},
&cli.StringFlag{
Name: "http-root",
Value: "/",
Value: flags.OverrideDefaultString(cfg.HTTP.Root, "/graph-explorer"),
Usage: "Root path of http server",
EnvVars: []string{"GRAPH_EXPLORER_HTTP_ROOT"},
Destination: &cfg.HTTP.Root,
},
&cli.StringFlag{
Name: "http-namespace",
Value: "com.owncloud.web",
Value: flags.OverrideDefaultString(cfg.HTTP.Namespace, "com.owncloud.web"),
Usage: "Set the base namespace for the http namespace",
EnvVars: []string{"GRAPH_EXPLORER_NAMESPACE"},
Destination: &cfg.HTTP.Namespace,
},
&cli.StringFlag{
Name: "issuer",
Value: "https://localhost:9130",
Value: flags.OverrideDefaultString(cfg.GraphExplorer.Issuer, "https://localhost:9200"),
Usage: "Set the OpenID Connect Provider",
EnvVars: []string{"GRAPH_EXPLORER_ISSUER"},
EnvVars: []string{"GRAPH_EXPLORER_ISSUER", "OCIS_URL"},
Destination: &cfg.GraphExplorer.Issuer,
},
&cli.StringFlag{
Name: "client-id",
Value: "ocis-explorer.js",
Value: flags.OverrideDefaultString(cfg.GraphExplorer.ClientID, "ocis-explorer.js"),
Usage: "Set the OpenID Client ID to send to the issuer",
EnvVars: []string{"GRAPH_EXPLORER_CLIENT_ID"},
Destination: &cfg.GraphExplorer.ClientID,
},
&cli.StringFlag{
Name: "graph-url",
Value: "http://localhost:9120",
Value: flags.OverrideDefaultString(cfg.GraphExplorer.GraphURL, "https://localhost:9200/graph"),
Usage: "Set the url to the graph api service",
EnvVars: []string{"GRAPH_EXPLORER_GRAPH_URL"},
Destination: &cfg.GraphExplorer.GraphURL,