Jimexist commented on code in PR #3540:
URL: https://github.com/apache/arrow-datafusion/pull/3540#discussion_r974899478


##########
datafusion-cli/src/main.rs:
##########
@@ -132,6 +179,48 @@ pub async fn main() -> Result<()> {
     Ok(())
 }
 
+fn build_s3_object_store_from_env(bucket_name: &str) -> Result<AmazonS3> {
+    let mut builder = AmazonS3Builder::new().with_bucket_name(bucket_name);
+
+    if let Ok(region) = env::var("AWS_REGION") {
+        builder = builder.with_region(region);
+    }
+
+    if let Ok(access_key) = env::var("AWS_ACCESS_KEY_ID") {
+        builder = builder.with_access_key_id(access_key);
+    }
+
+    if let Ok(key) = env::var("AWS_SECRET_ACCESS_KEY") {
+        builder = builder.with_secret_access_key(key);
+    }
+
+    if let Ok(token) = env::var("AWS_SESSION_TOKEN") {
+        builder = builder.with_token(token);
+    }

Review Comment:
   clap supports getting env var into param, see [here][1]
   
   [1]: https://docs.rs/clap/latest/clap/builder/struct.Arg.html#method.env



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: github-unsubscr...@arrow.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org

Reply via email to