Skip to content

Commit

Permalink
Read AWS_PROFILE to enable Shared Credentials provider (#11)
Browse files Browse the repository at this point in the history
  • Loading branch information
vinay-gopalan committed Sep 23, 2021
1 parent 8ef7ccd commit 5b6393a
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions awsutil/generate_credentials.go
Original file line number Diff line number Diff line change
Expand Up @@ -186,6 +186,13 @@ func (c *CredentialsConfig) GenerateCredentialChain(opt ...Option) (*credentials
}

if opts.withSharedCredentials {
profile := os.Getenv("AWS_PROFILE")
if profile != "" {
c.Profile = profile
}
if c.Profile == "" {
c.Profile = "default"
}
// Add the shared credentials provider
providers = append(providers, &credentials.SharedCredentialsProvider{
Filename: c.Filename,
Expand Down

0 comments on commit 5b6393a

Please sign in to comment.