Skip to content

Commit

Permalink
Merge pull request #28 from lusingander/profile-region
Browse files Browse the repository at this point in the history
Fix to load region from profile
  • Loading branch information
lusingander authored Sep 13, 2024
2 parents e48a9bb + dd49eac commit 4549e5a
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion src/client.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
use std::fmt::Debug;

use aws_config::{meta::region::RegionProviderChain, BehaviorVersion};
use aws_config::{default_provider::region, meta::region::RegionProviderChain, BehaviorVersion};
use aws_sdk_s3::{config::Region, operation::list_objects_v2::ListObjectsV2Output};
use chrono::TimeZone;

Expand Down Expand Up @@ -32,8 +32,13 @@ impl Client {
profile: Option<String>,
default_region_fallback: String,
) -> Client {
let mut region_builder = region::Builder::default();
if let Some(profile) = &profile {
region_builder = region_builder.profile_name(profile);
}
let region_provider = RegionProviderChain::first_try(region.map(Region::new))
.or_default_provider()
.or_else(region_builder.build())
.or_else(Region::new(default_region_fallback));

let mut config_loader =
Expand Down

0 comments on commit 4549e5a

Please sign in to comment.