-
Notifications
You must be signed in to change notification settings - Fork 826
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
…#864) * [login] allow sourcing STS credentials from environment * [login] source credentials from the environment when no profile is specified * [login] simplify code by using built-in NewEnvFromConfig of AWS SDK
- Loading branch information
1 parent
2a16a6f
commit f8eab90
Showing
6 changed files
with
67 additions
and
11 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
package vault | ||
|
||
import ( | ||
"context" | ||
"fmt" | ||
"github.com/aws/aws-sdk-go-v2/aws" | ||
"github.com/aws/aws-sdk-go-v2/config" | ||
) | ||
|
||
// EnvironmentVariablesCredentialsProvider retrieves AWS credentials available in the OS environment variables | ||
type EnvironmentVariablesCredentialsProvider struct { | ||
} | ||
|
||
func (m *EnvironmentVariablesCredentialsProvider) Retrieve(context.Context) (aws.Credentials, error) { | ||
configFromEnv, err := config.NewEnvConfig() | ||
if err != nil { | ||
err := fmt.Errorf("unable to authenticate to AWS through your environment variables: %w", err) | ||
return aws.Credentials{}, err | ||
} | ||
return configFromEnv.Credentials, nil | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters