Skip to content

Commit

Permalink
Use the region in profile config for the destination of login
Browse files Browse the repository at this point in the history
  • Loading branch information
lox committed Nov 20, 2016
1 parent 53e5850 commit 696c033
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion login.go
Original file line number Diff line number Diff line change
Expand Up @@ -118,9 +118,17 @@ func LoginCommand(app *kingpin.Application, input LoginCommandInput) {
return
}

destination := "https://console.aws.amazon.com/"
if region, ok := profiles[input.Profile]["region"]; ok {
destination = fmt.Sprintf(
"https://%s.console.aws.amazon.com/console/home?region=%s",
region, region,
)
}

loginUrl := fmt.Sprintf(
"https://signin.aws.amazon.com/federation?Action=login&Issuer=aws-vault&Destination=%s&SigninToken=%s",
url.QueryEscape("https://console.aws.amazon.com/"),
url.QueryEscape(destination),
url.QueryEscape(signinToken),
)

Expand Down

0 comments on commit 696c033

Please sign in to comment.