mirror of
https://github.com/BeamMP/BeamMP-Server.git
synced 2025-07-03 00:05:34 +00:00
return early after reading ENV in config
This commit is contained in:
parent
89db370e12
commit
221f491019
@ -175,6 +175,7 @@ void TConfig::TryReadValue(toml::value& Table, const std::string& Category, cons
|
|||||||
if (!Env.empty()) {
|
if (!Env.empty()) {
|
||||||
if (const char* envp = std::getenv(Env.data()); envp != nullptr && std::strcmp(envp, "") != 0) {
|
if (const char* envp = std::getenv(Env.data()); envp != nullptr && std::strcmp(envp, "") != 0) {
|
||||||
OutValue = std::string(envp);
|
OutValue = std::string(envp);
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (Table[Category.c_str()][Key.data()].is_string()) {
|
if (Table[Category.c_str()][Key.data()].is_string()) {
|
||||||
@ -187,6 +188,7 @@ void TConfig::TryReadValue(toml::value& Table, const std::string& Category, cons
|
|||||||
if (const char* envp = std::getenv(Env.data()); envp != nullptr && std::strcmp(envp, "") != 0) {
|
if (const char* envp = std::getenv(Env.data()); envp != nullptr && std::strcmp(envp, "") != 0) {
|
||||||
auto Str = std::string(envp);
|
auto Str = std::string(envp);
|
||||||
OutValue = Str == "1" || Str == "true";
|
OutValue = Str == "1" || Str == "true";
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (Table[Category.c_str()][Key.data()].is_boolean()) {
|
if (Table[Category.c_str()][Key.data()].is_boolean()) {
|
||||||
@ -198,6 +200,7 @@ void TConfig::TryReadValue(toml::value& Table, const std::string& Category, cons
|
|||||||
if (!Env.empty()) {
|
if (!Env.empty()) {
|
||||||
if (const char* envp = std::getenv(Env.data()); envp != nullptr && std::strcmp(envp, "") != 0) {
|
if (const char* envp = std::getenv(Env.data()); envp != nullptr && std::strcmp(envp, "") != 0) {
|
||||||
OutValue = int(std::strtol(envp, nullptr, 10));
|
OutValue = int(std::strtol(envp, nullptr, 10));
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (Table[Category.c_str()][Key.data()].is_integer()) {
|
if (Table[Category.c_str()][Key.data()].is_integer()) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user