Skip to content

Commit

Permalink
Uses environment variables for selecting credentials file profile
Browse files Browse the repository at this point in the history
Use AWS_DEFAULT_PROFILE as documented, falling back to AWS_PROFILE (used
by other tools), finally falling back to "default" if not provided.

Signed-off-by: Brian Bland <brian.bland@docker.com>
  • Loading branch information
BrianBland committed Feb 3, 2016
1 parent e57621c commit 6770071
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion aws/aws.go
Original file line number Diff line number Diff line change
Expand Up @@ -405,7 +405,13 @@ func EnvAuth() (auth Auth, err error) {
// http://blogs.aws.amazon.com/security/post/Tx3D6U6WSFGOK2H/A-New-and-Standardized-Way-to-Manage-Credentials-in-the-AWS-SDKs
func CredentialFileAuth(filePath string, profile string, expiration time.Duration) (auth Auth, err error) {
if profile == "" {
profile = "default"
profile = os.Getenv("AWS_DEFAULT_PROFILE")
if profile == "" {
profile = os.Getenv("AWS_PROFILE")
if profile == "" {
profile = "default"
}
}
}

if filePath == "" {
Expand Down

0 comments on commit 6770071

Please # to comment.