diff options
author | Mo <modisemorebodi@gmail.com> | 2021-01-04 17:55:20 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-01-04 16:55:20 +0100 |
commit | 3e5a3daf5983d9c6fd6b9cbf9a5b46abb9602346 (patch) | |
tree | 4920f078ea61cea580e0d125cb539b69aeca08a4 /cli/program_state.rs | |
parent | 1d4f8298a7cdead528b5c08c9b762b261d3b3ea3 (diff) |
BREAKING(unstable): remove CreateHttpClientOptions.caFile (#8928)
Diffstat (limited to 'cli/program_state.rs')
-rw-r--r-- | cli/program_state.rs | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/cli/program_state.rs b/cli/program_state.rs index e55386fe5..3000b355d 100644 --- a/cli/program_state.rs +++ b/cli/program_state.rs @@ -25,6 +25,7 @@ use deno_core::ModuleSource; use deno_core::ModuleSpecifier; use std::collections::HashMap; use std::env; +use std::fs::read_to_string; use std::sync::Arc; use std::sync::Mutex; @@ -58,7 +59,13 @@ impl ProgramState { let dir = deno_dir::DenoDir::new(custom_root)?; let deps_cache_location = dir.root.join("deps"); let http_cache = http_cache::HttpCache::new(&deps_cache_location); - let ca_file = flags.ca_file.clone().or_else(|| env::var("DENO_CERT").ok()); + let ca_file_path = + flags.ca_file.clone().or_else(|| env::var("DENO_CERT").ok()); + + let ca_data: Option<String> = match ca_file_path.as_ref() { + None => None, + Some(ca_file_path) => Some(read_to_string(ca_file_path)?), + }; let cache_usage = if flags.cached_only { CacheSetting::Only @@ -74,7 +81,7 @@ impl ProgramState { http_cache, cache_usage, !flags.no_remote, - ca_file.as_deref(), + ca_data.as_deref(), )?; let lockfile = if let Some(filename) = &flags.lock { |