From dd9d94f75f43420f7e51e42f24339de375ff4fd4 Mon Sep 17 00:00:00 2001 From: Daniel Seiler Date: Sat, 30 Dec 2023 08:04:09 +0100 Subject: [PATCH] feat: allow env var override for game config (#1367) --- dCommon/dConfig.cpp | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/dCommon/dConfig.cpp b/dCommon/dConfig.cpp index 35048d64..fc8097b8 100644 --- a/dCommon/dConfig.cpp +++ b/dCommon/dConfig.cpp @@ -34,6 +34,11 @@ void dConfig::ReloadConfig() { } const std::string& dConfig::GetValue(std::string key) { + std::string upper_key(key); + std::transform(upper_key.begin(), upper_key.end(), upper_key.begin(), ::toupper); + if (const char* env_p = std::getenv(upper_key.c_str())) { + this->m_ConfigValues[key] = env_p; + } return this->m_ConfigValues[key]; }