Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Change Credentials::from_env to Credentials::new #54

Merged
merged 1 commit into from
Jul 16, 2024

Conversation

agasparovic
Copy link
Contributor

Doing so will still allow setting them using env vars, but it also tries getting them from additional sources (which is useful when running on ECS, EC2, etc.):

See the implementation of Credentials::new at:
https://github.com/durch/rust-s3/blob/7182a4f85d576013b3ab553fddf3656344d7e477/aws-creds/src/credentials.rs#L301C9-L306C58

Credentials::from_sts_env("aws-creds")
            .or_else(|_| Credentials::from_env())
            .or_else(|_| Credentials::from_profile(profile))
            .or_else(|_| Credentials::from_instance_metadata_v2(false))
            .or_else(|_| Credentials::from_instance_metadata(false))
            .map_err(|_| CredentialsError::NoCredentials)

Doing so will still allow setting them using env vars, but it also tries getting them from additional sources (which is useful when running on ECS, EC2, etc.):

See the implementation of `Credentials::new` at:
https://github.com/durch/rust-s3/blob/7182a4f85d576013b3ab553fddf3656344d7e477/aws-creds/src/credentials.rs#L301C9-L306C58

```
Credentials::from_sts_env("aws-creds")
            .or_else(|_| Credentials::from_env())
            .or_else(|_| Credentials::from_profile(profile))
            .or_else(|_| Credentials::from_instance_metadata_v2(false))
            .or_else(|_| Credentials::from_instance_metadata(false))
            .map_err(|_| CredentialsError::NoCredentials)
```
Copy link
Member

@digizeph digizeph left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you for the PR! This looks good! Will create release soon.

@digizeph digizeph merged commit 7229cd8 into bgpkit:main Jul 16, 2024
1 check passed
@agasparovic agasparovic deleted the patch-1 branch July 17, 2024 01:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants