From 8fa2e2683bdb89aef5baf22957af1d86ed38aca7 Mon Sep 17 00:00:00 2001 From: sigoden Date: Sun, 12 Mar 2023 08:31:06 +0800 Subject: feat: support HTTPS_PROXY and ALL_PROXY (#68) --- src/config/mod.rs | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'src/config/mod.rs') diff --git a/src/config/mod.rs b/src/config/mod.rs index b0cd6c0..a37140c 100644 --- a/src/config/mod.rs +++ b/src/config/mod.rs @@ -106,6 +106,7 @@ impl Config { bail!("api_key not set"); } config.merge_env_vars(); + config.maybe_proxy(); config.load_roles()?; Ok(config) @@ -430,6 +431,15 @@ impl Config { } } } + + fn maybe_proxy(&mut self) { + if self.proxy.is_some() { + return; + } + if let Ok(value) = env::var("HTTPS_PROXY").or_else(|_| env::var("ALL_PROXY")) { + self.proxy = Some(value); + } + } } fn create_config_file(config_path: &Path) -> Result<()> { -- cgit v1.2.3