-
Notifications
You must be signed in to change notification settings - Fork 824
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
apply the proxy setting in wasmer config (#5091)
- Loading branch information
Showing
5 changed files
with
47 additions
and
52 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -5,7 +5,6 @@ use dialoguer::console::{style, Emoji}; | |
use indicatif::{ProgressBar, ProgressStyle}; | ||
use tempfile::NamedTempFile; | ||
use wasmer_config::package::{PackageIdent, PackageSource}; | ||
use wasmer_wasix::http::reqwest::get_proxy; | ||
|
||
use crate::config::WasmerEnv; | ||
|
||
|
@@ -28,10 +27,6 @@ pub struct PackageDownload { | |
#[clap(long)] | ||
pub quiet: bool, | ||
|
||
/// proxy to use for downloading | ||
#[clap(long)] | ||
pub proxy: Option<String>, | ||
|
||
/// The package to download. | ||
package: PackageSource, | ||
} | ||
|
@@ -101,13 +96,7 @@ impl PackageDownload { | |
// caveat: client_unauthennticated will use a token if provided, it | ||
// just won't fail if none is present. So, _unauthenticated() can actually | ||
// produce an authenticated client. | ||
let client = if let Some(proxy) = &self.proxy { | ||
let proxy = reqwest::Proxy::all(proxy)?; | ||
|
||
self.env.client_unauthennticated_with_proxy(proxy)? | ||
} else { | ||
self.env.client_unauthennticated()? | ||
}; | ||
let client = self.env.client_unauthennticated()?; | ||
|
||
let version = id.version_or_default().to_string(); | ||
let version = if version == "*" { | ||
|
@@ -171,7 +160,7 @@ impl PackageDownload { | |
|
||
let builder = { | ||
let mut builder = reqwest::blocking::ClientBuilder::new(); | ||
if let Some(proxy) = get_proxy()? { | ||
if let Some(proxy) = self.env.proxy()? { | ||
builder = builder.proxy(proxy); | ||
} | ||
builder | ||
|
@@ -309,7 +298,6 @@ mod tests { | |
out_path: Some(out_path.clone()), | ||
package: "wasmer/[email protected]".parse().unwrap(), | ||
quiet: true, | ||
proxy: None, | ||
}; | ||
|
||
cmd.execute().unwrap(); | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters