Skip to content

Commit

Permalink
Merge pull request #103 from 99designs/login-to-specific-region
Browse files Browse the repository at this point in the history
Login to the correct region based on profile config
  • Loading branch information
lox committed Nov 25, 2016
2 parents 53e5850 + 696c033 commit faa4c5d
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 faa4c5d

Please sign in to comment.