bwi/v2.3.1 #30
@ -1,5 +1,6 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
|
#include <algorithm>
|
||||||
#include <rublon/error.hpp>
|
#include <rublon/error.hpp>
|
||||||
#include <rublon/memory.hpp>
|
#include <rublon/memory.hpp>
|
||||||
#include <rublon/static_string.hpp>
|
#include <rublon/static_string.hpp>
|
||||||
@ -86,6 +87,7 @@ class ConfigurationReader {
|
|||||||
if(it == keyValues.end()) {
|
if(it == keyValues.end()) {
|
||||||
return std::nullopt;
|
return std::nullopt;
|
||||||
}
|
}
|
||||||
|
|
||||||
return string{it->second.data(), it->second.size(), memoryResource};
|
return string{it->second.data(), it->second.size(), memoryResource};
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -198,6 +200,12 @@ class ConfigurationReader {
|
|||||||
return true;
|
return true;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
auto toLowerCaseOpt = [](auto str) {
|
||||||
|
if(str)
|
||||||
|
std::transform(str->cbegin(), str->cend(), str->begin(), [](auto c) { return std::tolower(c); });
|
||||||
|
return str;
|
||||||
|
};
|
||||||
|
|
||||||
/// NOTE:
|
/// NOTE:
|
||||||
// getStringOpt can return a valid empty string, for example configuration entry like
|
// getStringOpt can return a valid empty string, for example configuration entry like
|
||||||
// option=
|
// option=
|
||||||
@ -238,8 +246,8 @@ class ConfigurationReader {
|
|||||||
|
|
||||||
// reading proxy configuration
|
// reading proxy configuration
|
||||||
config.proxyEnabled = getBool("proxyEnabled").value_or(false);
|
config.proxyEnabled = getBool("proxyEnabled").value_or(false);
|
||||||
config.proxyType = getStringOpt("proxyType");
|
config.proxyType = toLowerCaseOpt(getStringOpt("proxyType"));
|
||||||
config.proxyHost = getStringOpt("proxyHost");
|
config.proxyHost = toLowerCaseOpt(getStringOpt("proxyHost"));
|
||||||
|
|
||||||
// Apply fallback if no config is set
|
// Apply fallback if no config is set
|
||||||
if(config.proxyEnabled && (!config.proxyType || config.proxyType->empty()) && (!config.proxyHost || config.proxyHost->empty())) {
|
if(config.proxyEnabled && (!config.proxyType || config.proxyType->empty()) && (!config.proxyHost || config.proxyHost->empty())) {
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user