Skip to content

Commit

Permalink
Update main.go
Browse files Browse the repository at this point in the history
  • Loading branch information
qoomon authored Feb 1, 2018
1 parent 84ec13e commit c6d88d2
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions main.go
Original file line number Diff line number Diff line change
Expand Up @@ -125,6 +125,7 @@ func execWithCredentials(argv []string, creds *credentials.Value, region *string
os.Setenv("AWS_SECURITY_TOKEN", creds.SessionToken)
if region != nil {
os.Setenv("AWS_DEFAULT_REGION", *region)
os.Setenv("AWS_REGION", *region)
}

env := os.Environ()
Expand All @@ -141,6 +142,7 @@ func printCredentials(role string, creds *credentials.Value, region *string) {
fmt.Printf("export ASSUMED_ROLE=\"%s\"\n", role)
if region != nil {
fmt.Printf("export AWS_DEFAULT_REGION=\"%s\"\n", *region)
fmt.Printf("export AWS_REGION=\"%s\"\n", *region)
}
fmt.Printf("# Run this to configure your shell:\n")
fmt.Printf("# eval $(%s)\n", strings.Join(os.Args, " "))
Expand All @@ -156,6 +158,7 @@ func printFishCredentials(role string, creds *credentials.Value, region *string)
fmt.Printf("set -gx ASSUMED_ROLE \"%s\";\n", role)
if region != nil {
fmt.Printf("set -gx AWS_DEFAULT_REGION \"%s\";\n", *region)
fmt.Printf("set -gx AWS_REGION \"%s\";\n", *region)
}
fmt.Printf("# Run this to configure your shell:\n")
fmt.Printf("# eval (%s)\n", strings.Join(os.Args, " "))
Expand All @@ -171,6 +174,7 @@ func printPowerShellCredentials(role string, creds *credentials.Value, region *s
fmt.Printf("$env:ASSUMED_ROLE=\"%s\"\n", role)
if region != nil {
fmt.Printf("$env:AWS_DEFAULT_REGION=\"%s\"\n", *region)
fmt.Printf("$env:AWS_REGION=\"%s\"\n", *region)
}
fmt.Printf("# Run this to configure your shell:\n")
fmt.Printf("# %s | Invoke-Expression \n", strings.Join(os.Args, " "))
Expand Down

0 comments on commit c6d88d2

Please sign in to comment.