Skip to content

Commit

Permalink
fix: check also env vars in is_aws
Browse files Browse the repository at this point in the history
Signed-off-by: Ion Koutsouris <[email protected]>
  • Loading branch information
ion-elgreco committed Jan 8, 2025
1 parent fd0dee3 commit 1424e57
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 2 deletions.
1 change: 1 addition & 0 deletions crates/aws/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -780,6 +780,7 @@ mod tests {
unsafe {
std::env::set_var(crate::constants::AWS_S3_LOCKING_PROVIDER, "dynamodb");
}

let logstore = factory
.with_options(Arc::new(store), &url, &StorageOptions::from(HashMap::new()))
.unwrap();
Expand Down
10 changes: 8 additions & 2 deletions crates/aws/src/storage.rs
Original file line number Diff line number Diff line change
Expand Up @@ -98,12 +98,18 @@ fn aws_storage_handler(
// This function will return true in the default case since it's most likely that the absence of
// options will mean default/S3 configuration
fn is_aws(options: &StorageOptions) -> bool {
if options.0.contains_key(constants::AWS_FORCE_CREDENTIAL_LOAD) {
// Checks storage option first then env var for existence of aws force credential load
// .from_s3_env never inserts these into the options because they are delta-rs specific
if str_option(&options.0, constants::AWS_FORCE_CREDENTIAL_LOAD).is_some() {
return true;
}
if options.0.contains_key(constants::AWS_S3_LOCKING_PROVIDER) {

// Checks storage option first then env var for existence of locking provider
// .from_s3_env never inserts these into the options because they are delta-rs specific
if str_option(&options.0, constants::AWS_S3_LOCKING_PROVIDER).is_some() {
return true;
}

// Options at this stage should only contain 'aws_endpoint' in lowercase
// due to with_env_s3
!(options.0.contains_key("aws_endpoint") || options.0.contains_key(constants::AWS_ENDPOINT_URL))
Expand Down

0 comments on commit 1424e57

Please sign in to comment.