c++-ize the proxy detection code

Just for consistency with the rest
This commit is contained in:
Théophane Hufschmitt 2024-02-23 10:28:37 +01:00
parent d3bff699aa
commit bca737dcad

View file

@ -23,7 +23,6 @@
#include <netdb.h>
#include <netinet/in.h>
#include <regex>
#include <cstdlib>
#include <nlohmann/json.hpp>
@ -35,7 +34,7 @@ namespace nix {
static bool haveProxyEnvironmentVariables()
{
static const char * const proxyVariables[] = {
static const std::vector<std::string> proxyVariables = {
"http_proxy",
"https_proxy",
"ftp_proxy",
@ -44,7 +43,7 @@ static bool haveProxyEnvironmentVariables()
"FTP_PROXY"
};
for (auto & proxyVariable: proxyVariables) {
if (std::getenv(proxyVariable)) {
if (getEnv(proxyVariable).has_value()) {
return true;
}
}