This is an automated email from the ASF dual-hosted git repository.
mneumann pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/arrow-rs-object-store.git
The following commit(s) were added to refs/heads/main by this push:
new 6259202 Unify `from_env` behaviours (#652)
6259202 is described below
commit 62592027cb7d33ed843bc14fb77d7fc32f13ace5
Author: Miraculous Owonubi <[email protected]>
AuthorDate: Tue Mar 3 12:04:51 2026 +0100
Unify `from_env` behaviours (#652)
* parse_url_opts should match {S3,Azure,GCP}Builder::from_env
* fix AmazonS3Builder::from_env documentation
* fix parse_url_opts documentation
* update test_url_http to ingest case insensitive data
* fix sentence cut off
---
src/aws/builder.rs | 1 -
src/parse.rs | 16 +++++++++-------
2 files changed, 9 insertions(+), 8 deletions(-)
diff --git a/src/aws/builder.rs b/src/aws/builder.rs
index 20199da..b698cf0 100644
--- a/src/aws/builder.rs
+++ b/src/aws/builder.rs
@@ -546,7 +546,6 @@ impl AmazonS3Builder {
///
/// All environment variables starting with `AWS_` will be evaluated.
/// Names must match acceptable input to [`AmazonS3ConfigKey::from_str`].
- /// Only upper-case environment variables are accepted.
///
/// Some examples of variables extracted from environment:
/// * `AWS_ACCESS_KEY_ID` -> access_key_id
diff --git a/src/parse.rs b/src/parse.rs
index 371d7ad..b30fea7 100644
--- a/src/parse.rs
+++ b/src/parse.rs
@@ -144,7 +144,7 @@ macro_rules! builder_opts {
($builder:ty, $url:expr, $options:expr) => {{
let builder = $options.into_iter().fold(
<$builder>::new().with_url($url.to_string()),
- |builder, (key, value)| match key.as_ref().parse() {
+ |builder, (key, value)| match
key.as_ref().to_ascii_lowercase().parse() {
Ok(k) => builder.with_config(k, value),
Err(_) => builder,
},
@@ -177,9 +177,7 @@ pub fn parse_url(url: &Url) -> Result<(Box<dyn
ObjectStore>, Path), super::Error
/// * `options`: A list of key-value pairs to pass to the [`ObjectStore`]
builder.
/// Note different object stores accept different configuration options, so
/// the options that are read depends on the `url` value. One common pattern
-/// is to pass configuration information via process variables using
-/// [`std::env::vars`]. Keys must be lower-case and match the list of
supported
-/// keys to apply successfully.
+/// is to pass configuration information via process variables using
[`std::env::vars`].
///
/// Returns
/// - An [`ObjectStore`] of the corresponding type
@@ -435,15 +433,19 @@ mod tests {
server.push_fn(|r| {
assert_eq!(r.uri().path(), "/foo/bar");
assert_eq!(r.headers().get(USER_AGENT).unwrap(), "test_url");
- Response::new(String::new())
+ Response::new(String::from("result"))
});
let test = format!("{}/foo/bar", server.url());
- let opts = [("user_agent", "test_url"), ("allow_http", "true")];
+ let opts = [("USER_AGENT", "test_url"), ("allow_http", "true")];
let url = test.parse().unwrap();
let (store, path) = parse_url_opts(&url, opts).unwrap();
assert_eq!(path.as_ref(), "foo/bar");
- store.get(&path).await.unwrap();
+
+ let res = store.get(&path).await.unwrap();
+ let body = res.bytes().await.unwrap();
+ let body = str::from_utf8(&body).unwrap();
+ assert_eq!(body, "result");
server.shutdown().await;
}