Skip to content

Commit

Permalink
Support adding root cert via env CARGO_HTTP_CAINFO, `SSL_CERT_{FILE…
Browse files Browse the repository at this point in the history
…, PATH}`

Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
  • Loading branch information
NobodyXu committed Feb 13, 2023
1 parent d39516e commit 181d091
Showing 1 changed file with 14 additions and 1 deletion.
15 changes: 14 additions & 1 deletion crates/bin/src/entry.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,11 @@ use binstalk::{
errors::BinstallError,
fetchers::{Fetcher, GhCrateMeta, QuickInstall},
get_desired_targets,
helpers::{jobserver_client::LazyJobserverClient, remote::Client, tasks::AutoAbortJoinHandle},
helpers::{
jobserver_client::LazyJobserverClient,
remote::{Certificate, Client},
tasks::AutoAbortJoinHandle,
},
ops::{
self,
resolve::{CrateName, Resolution, ResolutionFetch, VersionReqExt},
Expand Down Expand Up @@ -73,6 +77,15 @@ pub async fn install_crates(args: Args, jobserver_client: LazyJobserverClient) -
args.min_tls_version.map(|v| v.into()),
Duration::from_millis(rate_limit.duration.get()),
rate_limit.request_count,
["CARGO_HTTP_CAINFO", "SSL_CERT_FILE", "SSL_CERT_PATH"]
.into_iter()
.filter_map(|env_name| match Certificate::from_env(env_name) {
Ok(option) => option,
Err(err) => {
warn!("Failed to load root certificate specified by env {env_name}: {err}",);
None
}
}),
)
.map_err(BinstallError::from)?;

Expand Down

0 comments on commit 181d091

Please sign in to comment.