Skip to content

Commit 45c6809

Browse files
committed
rename field name: no_proxy_domains -> non_proxy_hosts
1 parent c9535c6 commit 45c6809

File tree

2 files changed

+15
-15
lines changed

2 files changed

+15
-15
lines changed

crates/pixi_config/src/lib.rs

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -798,21 +798,21 @@ pub struct ProxyConfig {
798798
/// A list of no proxy pattern
799799
#[serde(default)]
800800
#[serde(skip_serializing_if = "Vec::is_empty")]
801-
pub no_proxy_domains: Vec<String>,
801+
pub non_proxy_hosts: Vec<String>,
802802
}
803803

804804
impl ProxyConfig {
805805
pub fn is_default(&self) -> bool {
806-
self.https.is_none() && self.https.is_none() && self.no_proxy_domains.is_empty()
806+
self.https.is_none() && self.https.is_none() && self.non_proxy_hosts.is_empty()
807807
}
808808
pub fn merge(&self, other: Self) -> Self {
809809
Self {
810810
https: other.https.as_ref().or(self.https.as_ref()).cloned(),
811811
http: other.http.as_ref().or(self.http.as_ref()).cloned(),
812-
no_proxy_domains: if other.is_default() {
813-
self.no_proxy_domains.clone()
812+
non_proxy_hosts: if other.is_default() {
813+
self.non_proxy_hosts.clone()
814814
} else {
815-
other.no_proxy_domains.clone()
815+
other.non_proxy_hosts.clone()
816816
},
817817
}
818818
}
@@ -1085,7 +1085,7 @@ impl Config {
10851085
"proxy-config",
10861086
"proxy-config.https",
10871087
"proxy-config.http",
1088-
"proxy-config.no-proxy-domains",
1088+
"proxy-config.non-proxy-hosts",
10891089
]
10901090
}
10911091

@@ -1205,8 +1205,8 @@ impl Config {
12051205

12061206
pub fn activate_proxy_envs(&self) {
12071207
if self.proxy_config.https.is_none() && self.proxy_config.http.is_none() {
1208-
if !self.proxy_config.no_proxy_domains.is_empty() {
1209-
tracing::info!("proxy_config.no_proxy_domains is ignored")
1208+
if !self.proxy_config.non_proxy_hosts.is_empty() {
1209+
tracing::info!("proxy_config.non_proxy_hosts is ignored")
12101210
}
12111211
return;
12121212
}
@@ -1223,7 +1223,7 @@ impl Config {
12231223
.find_map(|&k| std::env::var(k).ok().filter(|v| !v.is_empty()));
12241224

12251225
let config_no_proxy =
1226-
Some(self.proxy_config.no_proxy_domains.iter().join(",")).filter(|v| !v.is_empty());
1226+
Some(self.proxy_config.non_proxy_hosts.iter().join(",")).filter(|v| !v.is_empty());
12271227

12281228
if env_https_proxy.is_some() || env_http_proxy.is_some() {
12291229
if env_https_proxy.as_deref() != self.proxy_config.https.as_ref().map(Url::as_str)
@@ -1544,8 +1544,8 @@ impl Config {
15441544
.transpose()
15451545
.into_diagnostic()?;
15461546
}
1547-
"no-proxy-domains" => {
1548-
self.proxy_config.no_proxy_domains = value
1547+
"non-proxy-hosts" => {
1548+
self.proxy_config.non_proxy_hosts = value
15491549
.map(|v| serde_json::de::from_str(&v))
15501550
.transpose()
15511551
.into_diagnostic()?
@@ -2286,7 +2286,7 @@ UNUSED = "unused"
22862286
[proxy-config]
22872287
https = "http://proxy-for-https"
22882288
http = "http://proxy-for-http"
2289-
no-proxy-domains = [ "a.com" ]
2289+
non-proxy-hosts = [ "a.com" ]
22902290
"#;
22912291
let (config, _) = Config::from_toml(toml, None).unwrap();
22922292
assert_eq!(
@@ -2297,7 +2297,7 @@ UNUSED = "unused"
22972297
config.proxy_config.http,
22982298
Some(Url::parse("http://proxy-for-http").unwrap())
22992299
);
2300-
assert_eq!(config.proxy_config.no_proxy_domains.len(), 1);
2301-
assert_eq!(config.proxy_config.no_proxy_domains[0], "a.com");
2300+
assert_eq!(config.proxy_config.non_proxy_hosts.len(), 1);
2301+
assert_eq!(config.proxy_config.non_proxy_hosts[0], "a.com");
23022302
}
23032303
}

crates/pixi_config/src/snapshots/pixi_config__tests__config_merge_multiple.snap

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -136,7 +136,7 @@ Config {
136136
proxy_config: ProxyConfig {
137137
https: None,
138138
http: None,
139-
no_proxy_domains: [],
139+
non_proxy_hosts: [],
140140
},
141141
change_ps1: None,
142142
force_activate: None,

0 commit comments

Comments
 (0)