Skip to content

Commit

Permalink
add client-id flag
Browse files Browse the repository at this point in the history
Signed-off-by: Jörn Friedrich Dreyer <jfd@butonic.de>
  • Loading branch information
butonic authored and DeepDiver1975 committed Jan 24, 2020
1 parent 3b2e1da commit bc43bfe
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 3 deletions.
2 changes: 1 addition & 1 deletion pkg/config/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ type Tracing struct {
type GraphExplorer struct {
ClientID string
Issuer string
GraphUrl string
GraphURL string
}

// Config combines all available configuration parts.
Expand Down
9 changes: 8 additions & 1 deletion pkg/flagset/flagset.go
Original file line number Diff line number Diff line change
Expand Up @@ -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,
},
}
}
2 changes: 1 addition & 1 deletion pkg/service/v0/service.go
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down

0 comments on commit bc43bfe

Please sign in to comment.