Skip to content

Commit

Permalink
Allow URL override for open links (#63)
Browse files Browse the repository at this point in the history
  • Loading branch information
patricksanders committed Apr 8, 2021
1 parent 9289745 commit f16e551
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion creds/consoleme.go
Original file line number Diff line number Diff line change
Expand Up @@ -207,7 +207,16 @@ func (c *Client) GetResourceURL(arn string) (string, error) {
if err := json.Unmarshal(document, &responseParsed); err != nil {
return "", errors.Wrap(err, "failed to unmarshal JSON")
}
return viper.GetString("consoleme_url") + responseParsed.Data["url"], nil
return baseWebURL() + responseParsed.Data["url"], nil
}

// baseWebURL allows the ConsoleMe URL to be overridden for cases where the API
// and UI are accessed via different URLs
func baseWebURL() string {
if override := viper.GetString("consoleme_open_url_override"); override != "" {
return override
}
return viper.GetString("consoleme_url")
}

func parseWebError(rawErrorResponse []byte) error {
Expand Down

0 comments on commit f16e551

Please sign in to comment.