From 677007167a3af6dcee5965751384b7e268c584ac Mon Sep 17 00:00:00 2001 From: Brian Bland Date: Tue, 2 Feb 2016 17:31:27 -0800 Subject: [PATCH] Uses environment variables for selecting credentials file profile 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 --- aws/aws.go | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/aws/aws.go b/aws/aws.go index 9939f92c..013b2536 100644 --- a/aws/aws.go +++ b/aws/aws.go @@ -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 == "" {