You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@opendal.apache.org by xu...@apache.org on 2024/06/07 08:16:04 UTC

(opendal) branch main updated: feat(core): Azblob supports azure workload identity (#4705)

This is an automated email from the ASF dual-hosted git repository.

xuanwo pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/opendal.git


The following commit(s) were added to refs/heads/main by this push:
     new e37409cc65 feat(core): Azblob supports azure workload identity (#4705)
e37409cc65 is described below

commit e37409cc65531d1832eeb9c2a358a7cf83ad74c2
Author: Xuanwo <gi...@xuanwo.io>
AuthorDate: Fri Jun 7 16:15:51 2024 +0800

    feat(core): Azblob supports azure workload identity (#4705)
    
    Signed-off-by: Xuanwo <gi...@xuanwo.io>
---
 bin/ofs/Cargo.lock                  |  4 ++--
 bin/oli/Cargo.lock                  |  4 ++--
 core/Cargo.lock                     |  4 ++--
 core/Cargo.toml                     |  2 +-
 core/src/services/azblob/backend.rs | 28 ++++++++++++++++++----------
 5 files changed, 25 insertions(+), 17 deletions(-)

diff --git a/bin/ofs/Cargo.lock b/bin/ofs/Cargo.lock
index 09a1460f7a..42f4e57175 100644
--- a/bin/ofs/Cargo.lock
+++ b/bin/ofs/Cargo.lock
@@ -1139,9 +1139,9 @@ checksum = "c08c74e62047bb2de4ff487b251e4a92e24f48745648451635cec7d591162d9f"
 
 [[package]]
 name = "reqsign"
-version = "0.15.0"
+version = "0.15.2"
 source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "01edce6b6c31a16ebc7525ac58c747a6d78bbce33e76bbebd350d6bc25b23e06"
+checksum = "70fe66d4cd0b5ed9b1abbfe639bf6baeaaf509f7da2d51b31111ba945be59286"
 dependencies = [
  "anyhow",
  "async-trait",
diff --git a/bin/oli/Cargo.lock b/bin/oli/Cargo.lock
index 1a1f039509..eca6b2b666 100644
--- a/bin/oli/Cargo.lock
+++ b/bin/oli/Cargo.lock
@@ -2605,9 +2605,9 @@ checksum = "c08c74e62047bb2de4ff487b251e4a92e24f48745648451635cec7d591162d9f"
 
 [[package]]
 name = "reqsign"
-version = "0.15.0"
+version = "0.15.2"
 source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "01edce6b6c31a16ebc7525ac58c747a6d78bbce33e76bbebd350d6bc25b23e06"
+checksum = "70fe66d4cd0b5ed9b1abbfe639bf6baeaaf509f7da2d51b31111ba945be59286"
 dependencies = [
  "anyhow",
  "async-trait",
diff --git a/core/Cargo.lock b/core/Cargo.lock
index 9568352475..630de75442 100644
--- a/core/Cargo.lock
+++ b/core/Cargo.lock
@@ -6130,9 +6130,9 @@ dependencies = [
 
 [[package]]
 name = "reqsign"
-version = "0.15.0"
+version = "0.15.2"
 source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "01edce6b6c31a16ebc7525ac58c747a6d78bbce33e76bbebd350d6bc25b23e06"
+checksum = "70fe66d4cd0b5ed9b1abbfe639bf6baeaaf509f7da2d51b31111ba945be59286"
 dependencies = [
  "anyhow",
  "async-trait",
diff --git a/core/Cargo.toml b/core/Cargo.toml
index 60aa5ae958..6cba0f7007 100644
--- a/core/Cargo.toml
+++ b/core/Cargo.toml
@@ -264,7 +264,7 @@ sha1 = { version = "0.10.6", optional = true }
 sha2 = { version = "0.10", optional = true }
 
 # For http based services.
-reqsign = { version = "0.15.0", default-features = false, optional = true }
+reqsign = { version = "0.15.2", default-features = false, optional = true }
 
 # for services-atomic-server
 atomic_lib = { version = "0.34.5", optional = true }
diff --git a/core/src/services/azblob/backend.rs b/core/src/services/azblob/backend.rs
index 2001881d09..1f63290bea 100644
--- a/core/src/services/azblob/backend.rs
+++ b/core/src/services/azblob/backend.rs
@@ -439,16 +439,24 @@ impl Builder for AzblobBuilder {
             })?
         };
 
-        let config_loader = AzureStorageConfig {
-            account_name: self
-                .config
-                .account_name
-                .clone()
-                .or_else(|| infer_storage_name_from_endpoint(endpoint.as_str())),
-            account_key: self.config.account_key.clone(),
-            sas_token: self.config.sas_token.clone(),
-            ..Default::default()
-        };
+        let mut config_loader = AzureStorageConfig::default().from_env();
+
+        if let Some(v) = self
+            .config
+            .account_name
+            .clone()
+            .or_else(|| infer_storage_name_from_endpoint(endpoint.as_str()))
+        {
+            config_loader.account_name = Some(v);
+        }
+
+        if let Some(v) = self.config.account_key.clone() {
+            config_loader.account_key = Some(v);
+        }
+
+        if let Some(v) = self.config.sas_token.clone() {
+            config_loader.sas_token = Some(v);
+        }
 
         let encryption_key =
             match &self.config.encryption_key {