From bc43bfe578b7c7c847fe92ba651ff7d3c38269d3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=B6rn=20Friedrich=20Dreyer?= Date: Fri, 24 Jan 2020 08:35:41 +0100 Subject: [PATCH] add client-id flag MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Jörn Friedrich Dreyer --- pkg/config/config.go | 2 +- pkg/flagset/flagset.go | 9 ++++++++- pkg/service/v0/service.go | 2 +- 3 files changed, 10 insertions(+), 3 deletions(-) diff --git a/pkg/config/config.go b/pkg/config/config.go index cad6a0e938..e1151908b0 100644 --- a/pkg/config/config.go +++ b/pkg/config/config.go @@ -35,7 +35,7 @@ type Tracing struct { type GraphExplorer struct { ClientID string Issuer string - GraphUrl string + GraphURL string } // Config combines all available configuration parts. diff --git a/pkg/flagset/flagset.go b/pkg/flagset/flagset.go index dc0311cf84..8d3d43933e 100644 --- a/pkg/flagset/flagset.go +++ b/pkg/flagset/flagset.go @@ -134,12 +134,19 @@ func ServerWithConfig(cfg *config.Config) []cli.Flag { EnvVar: "GRAPH_EXPLORER_ISSUER", Destination: &cfg.GraphExplorer.Issuer, }, + &cli.StringFlag{ + Name: "client-id", + Value: "graph_explorer", + Usage: "Set the OpenID Client ID to send to the issuer", + EnvVar: "GRAPH_EXPLORER_CLIENT_ID", + Destination: &cfg.GraphExplorer.ClientID, + }, &cli.StringFlag{ Name: "graph-url", Value: "http://localhost:9120", Usage: "Set the url to the graph api service", EnvVar: "GRAPH_EXPLORER_GRAPH_URL", - Destination: &cfg.GraphExplorer.GraphUrl, + Destination: &cfg.GraphExplorer.GraphURL, }, } } diff --git a/pkg/service/v0/service.go b/pkg/service/v0/service.go index b1385f874b..bcc9251b2a 100644 --- a/pkg/service/v0/service.go +++ b/pkg/service/v0/service.go @@ -62,7 +62,7 @@ func (p GraphExplorer) ConfigJs(w http.ResponseWriter, r *http.Request) { w.WriteHeader(http.StatusOK) io.WriteString(w, fmt.Sprintf("window.ClientId = \"%v\";", p.config.GraphExplorer.ClientID)) io.WriteString(w, fmt.Sprintf("window.Iss = \"%v\";", p.config.GraphExplorer.Issuer)) - io.WriteString(w, fmt.Sprintf("window.GraphUrl = \"%v\";", p.config.GraphExplorer.GraphUrl)) + io.WriteString(w, fmt.Sprintf("window.GraphUrl = \"%v\";", p.config.GraphExplorer.GraphURL)) } // Static simply serves all static files.