Skip to content

Commit

Permalink
fix: set token provider explicitly
Browse files Browse the repository at this point in the history
  • Loading branch information
ion-elgreco committed Aug 22, 2024
1 parent fcd62ab commit 01763ca
Showing 1 changed file with 18 additions and 2 deletions.
20 changes: 18 additions & 2 deletions crates/aws/src/storage.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
//! AWS S3 storage backend.

use aws_config::default_provider::token::DefaultTokenChain;
use aws_config::meta::region::ProvideRegion;
use aws_config::provider_config::ProviderConfig;
use aws_config::{Region, SdkConfig};
Expand Down Expand Up @@ -208,6 +209,16 @@ impl S3StorageOptions {
imds_timeout,
&provider_config,
);

let token_provider: DefaultTokenChain = execute_sdk_future(
DefaultTokenChain::builder()
.region(crate::credentials::new_region_provider(
disable_imds,
imds_timeout,
))
.build(),
)?;

#[cfg(feature = "native-tls")]
let sdk_config = execute_sdk_future(
loader
Expand All @@ -217,11 +228,16 @@ impl S3StorageOptions {
.unwrap_or(false),
))
.credentials_provider(credentials_provider)
.token_provider(token_provider)
.load(),
)?;
#[cfg(feature = "rustls")]
let sdk_config =
execute_sdk_future(loader.credentials_provider(credentials_provider).load())?;
let sdk_config = execute_sdk_future(
loader
.credentials_provider(credentials_provider)
.token_provider(token_provider)
.load(),
)?;

Ok(Self {
virtual_hosted_style_request,
Expand Down

0 comments on commit 01763ca

Please sign in to comment.