add client-id flag

Signed-off-by: Jörn Friedrich Dreyer <jfd@butonic.de>
This commit is contained in:
Jörn Friedrich Dreyer
2020-01-24 08:35:41 +01:00
committed by Thomas Müller
parent 3b2e1da63f
commit bc43bfe578
3 changed files with 10 additions and 3 deletions

View File

@@ -35,7 +35,7 @@ type Tracing struct {
type GraphExplorer struct {
ClientID string
Issuer string
GraphUrl string
GraphURL string
}
// Config combines all available configuration parts.

View File

@@ -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,
},
}
}

View File

@@ -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.