diff options
| author | David Lönnhager <david.l@mullvad.net> | 2022-11-22 10:13:50 +0100 |
|---|---|---|
| committer | David Lönnhager <david.l@mullvad.net> | 2022-11-28 12:54:49 +0100 |
| commit | 3370eecc8c9590634fb486651263b1166e4703dc (patch) | |
| tree | 068b4470edd0083ba4358dad7328104be34568ee | |
| parent | 25c1459c8a97bb862f1a4c6272f4f9e85def41aa (diff) | |
| download | mullvadvpn-3370eecc8c9590634fb486651263b1166e4703dc.tar.xz mullvadvpn-3370eecc8c9590634fb486651263b1166e4703dc.zip | |
Warn about MULLVAD_API_DISABLE_TLS being set if the API address and host are not
| -rw-r--r-- | mullvad-api/src/lib.rs | 13 |
1 files changed, 10 insertions, 3 deletions
diff --git a/mullvad-api/src/lib.rs b/mullvad-api/src/lib.rs index 8684a3e19e..f34de57f66 100644 --- a/mullvad-api/src/lib.rs +++ b/mullvad-api/src/lib.rs @@ -142,9 +142,16 @@ impl ApiEndpoint { force_direct_connection: false, }; - if cfg!(feature = "api-override") && (host_var.is_some() || address_var.is_some()) { + if cfg!(feature = "api-override") { use std::net::ToSocketAddrs; + if host_var.is_none() && address_var.is_none() { + if disable_tls_var.is_some() { + log::warn!("MULLVAD_API_DISABLE_TLS is ignored since MULLVAD_API_HOST and MULLVAD_API_ADDR are not set"); + } + return api; + } + let scheme = if let Some(disable_tls_var) = disable_tls_var { api.disable_tls = disable_tls_var != "0"; "http://" @@ -170,8 +177,8 @@ impl ApiEndpoint { api.disable_address_cache = true; api.force_direct_connection = true; log::debug!("Overriding API. Using {} at {scheme}{}", api.host, api.addr); - } else if host_var.is_some() || address_var.is_some() { - log::warn!("MULLVAD_API_HOST and MULLVAD_API_ADDR are ignored in production builds"); + } else if host_var.is_some() || address_var.is_some() || disable_tls_var.is_some() { + log::warn!("These variables are ignored in production builds: MULLVAD_API_HOST, MULLVAD_API_ADDR, MULLVAD_API_DISABLE_TLS"); } api } |
