Skip to content

Commit

Permalink
fix
Browse files Browse the repository at this point in the history
  • Loading branch information
pavelzw committed Jan 31, 2025
1 parent cabe7d9 commit 670acd8
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 11 deletions.
18 changes: 9 additions & 9 deletions crates/pixi_config/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1204,7 +1204,7 @@ impl Config {
Url::parse(&value).into_diagnostic()?;
} else {
return Err(miette!(
"s3-config.{}.endpoint-url requires a value",
"s3-options.{}.endpoint-url requires a value",
bucket
));
}
Expand All @@ -1214,7 +1214,7 @@ impl Config {
bucket_config.region = value;
} else {
return Err(miette!(
"s3-config.{}.region requires a value",
"s3-options.{}.region requires a value",
bucket
));
}
Expand All @@ -1225,7 +1225,7 @@ impl Config {
value.parse().into_diagnostic()?;
} else {
return Err(miette!(
"s3-config.{}.force-path-style requires a value",
"s3-options.{}.force-path-style requires a value",
bucket
));
}
Expand Down Expand Up @@ -1499,25 +1499,25 @@ UNUSED = "unused"
}

#[test]
fn test_s3_config_parse() {
fn test_s3_options_parse() {
let toml = r#"
[s3-options.bucket1]
endpoint-url = "https://my-s3-host"
region = "us-east-1"
force-path-style = false
"#;
let (config, _) = Config::from_toml(toml).unwrap();
let s3_config = config.s3_options;
let s3_options = config.s3_options;
assert_eq!(
s3_config["bucket1"].endpoint_url,
s3_options["bucket1"].endpoint_url,
Url::parse("https://my-s3-host").unwrap()
);
assert_eq!(s3_config["bucket1"].region, "us-east-1");
assert!(!s3_config["bucket1"].force_path_style);
assert_eq!(s3_options["bucket1"].region, "us-east-1");
assert!(!s3_options["bucket1"].force_path_style);
}

#[test]
fn test_s3_config_invalid_config() {
fn test_s3_options_invalid_config() {
let toml = r#"
[s3-options.bucket1]
endpoint-url = "https://my-s3-host"
Expand Down
4 changes: 2 additions & 2 deletions src/cli/init.rs
Original file line number Diff line number Diff line change
Expand Up @@ -553,7 +553,7 @@ fn render_project(
}

fn relevant_s3_options(
s3_config: HashMap<String, pixi_config::S3Options>,
s3_options: HashMap<String, pixi_config::S3Options>,
channels: Vec<NamedChannelOrUrl>,
) -> HashMap<String, pixi_config::S3Options> {
// only take s3 options in manifest if they are used in the default channels
Expand All @@ -572,7 +572,7 @@ fn relevant_s3_options(
})
.collect::<Vec<_>>();

s3_config
s3_options
.into_iter()
.filter(|(key, _)| s3_buckets.contains(key))
.collect()
Expand Down

0 comments on commit 670acd8

Please sign in to comment.