Skip to content

Commit

Permalink
dont invoke Azure CLI if env var disabled
Browse files Browse the repository at this point in the history
  • Loading branch information
nameexhaustion committed Jan 10, 2025
1 parent 3fc79fa commit 056089f
Showing 1 changed file with 15 additions and 13 deletions.
28 changes: 15 additions & 13 deletions crates/polars-io/src/cloud/options.rs
Original file line number Diff line number Diff line change
Expand Up @@ -426,11 +426,18 @@ impl CloudOptions {
.with_url(url)
.with_retry(get_retry_config(self.max_retries));

let azure_cli_account_key = extract_adls_uri_storage_account(url) // Prefer the one embedded in the path
.map(|x| x.into())
.or(storage_account)
.as_deref()
.and_then(get_azure_storage_account_key);
let cfg_use_account_key = std::env::var("POLARS_AUTO_AZURE_ACCOUNT_KEY");
let cfg_use_account_key = cfg_use_account_key.as_deref();

let azure_cli_account_key = if cfg_use_account_key != Ok("0") {
extract_adls_uri_storage_account(url) // Prefer the one embedded in the path
.map(|x| x.into())
.or(storage_account)
.as_deref()
.and_then(get_azure_storage_account_key)
} else {
None
};

let builder_copy = azure_cli_account_key.is_some().then(|| builder.clone());

Expand All @@ -448,7 +455,8 @@ impl CloudOptions {

if verbose {
eprintln!(
"[CloudOptions::build_azure]: azure_cli_account_key: {:?}",
"[CloudOptions::build_azure]: cfg_use_account_key: {:?}, azure_cli_account_key: {:?}",
cfg_use_account_key,
azure_cli_account_key.as_ref().map(|_| "<redacted>")
);
}
Expand All @@ -472,14 +480,8 @@ impl CloudOptions {
return Ok(store);
}

let cfg_use_account_key = std::env::var("POLARS_AUTO_AZURE_ACCOUNT_KEY");
let cfg_use_account_key = cfg_use_account_key.as_deref();

if verbose {
eprintln!(
"[CloudOptions::build_azure]: Permission check failed, cfg_use_account_key={:?}",
cfg_use_account_key
);
eprintln!("[CloudOptions::build_azure]: Permission check failed");
}

if cfg_use_account_key != Ok("1") {
Expand Down

0 comments on commit 056089f

Please sign in to comment.