From ca11f353b05908d2ed58bb811ff474c3b05764cf Mon Sep 17 00:00:00 2001 From: Tixx <83774803+WiserTixx@users.noreply.github.com> Date: Sat, 17 May 2025 01:04:05 +0200 Subject: [PATCH 1/2] Log IP setting in debug mode --- src/TConfig.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/src/TConfig.cpp b/src/TConfig.cpp index 9fa21b4..19dc302 100644 --- a/src/TConfig.cpp +++ b/src/TConfig.cpp @@ -309,6 +309,7 @@ void TConfig::PrintDebug() { beammp_debug(std::string(StrPrivate) + ": " + std::string(Application::Settings.getAsBool(Settings::Key::General_Private) ? "true" : "false")); beammp_debug(std::string(StrInformationPacket) + ": " + std::string(Application::Settings.getAsBool(Settings::Key::General_InformationPacket) ? "true" : "false")); beammp_debug(std::string(StrPort) + ": " + std::to_string(Application::Settings.getAsInt(Settings::Key::General_Port))); + beammp_debug(std::string(StrIP) + ": \"" + Application::Settings.getAsString(Settings::Key::General_IP) + "\""); beammp_debug(std::string(StrMaxCars) + ": " + std::to_string(Application::Settings.getAsInt(Settings::Key::General_MaxCars))); beammp_debug(std::string(StrMaxPlayers) + ": " + std::to_string(Application::Settings.getAsInt(Settings::Key::General_MaxPlayers))); beammp_debug(std::string(StrMap) + ": \"" + Application::Settings.getAsString(Settings::Key::General_Map) + "\""); From 068f553fa95e61597e83651e0a69e09e539af015 Mon Sep 17 00:00:00 2001 From: Tixx <83774803+WiserTixx@users.noreply.github.com> Date: Sat, 17 May 2025 01:04:55 +0200 Subject: [PATCH 2/2] Add BEAMMP_PROVIDER_IP_ENV --- include/Env.h | 1 + src/Env.cpp | 3 +++ src/TConfig.cpp | 6 +++++- 3 files changed, 9 insertions(+), 1 deletion(-) diff --git a/include/Env.h b/include/Env.h index 749cb3e..94aa992 100644 --- a/include/Env.h +++ b/include/Env.h @@ -27,6 +27,7 @@ enum class Key { PROVIDER_UPDATE_MESSAGE, PROVIDER_DISABLE_CONFIG, PROVIDER_PORT_ENV, + PROVIDER_IP_ENV }; std::optional Get(Key key); diff --git a/src/Env.cpp b/src/Env.cpp index a969de3..0988995 100644 --- a/src/Env.cpp +++ b/src/Env.cpp @@ -39,6 +39,9 @@ std::string_view Env::ToString(Env::Key key) { case Key::PROVIDER_PORT_ENV: return "BEAMMP_PROVIDER_PORT_ENV"; break; + case Key::PROVIDER_IP_ENV: + return "BEAMMP_PROVIDER_IP_ENV"; + break; } return ""; } diff --git a/src/TConfig.cpp b/src/TConfig.cpp index 19dc302..818e00f 100644 --- a/src/TConfig.cpp +++ b/src/TConfig.cpp @@ -258,7 +258,11 @@ void TConfig::ParseFromFile(std::string_view name) { } else { TryReadValue(data, "General", StrPort, EnvStrPort, Settings::Key::General_Port); } - TryReadValue(data, "General", StrIP, EnvStrIP, Settings::Key::General_IP); + if (Env::Get(Env::Key::PROVIDER_IP_ENV).has_value()) { + TryReadValue(data, "General", StrIP, Env::Get(Env::Key::PROVIDER_IP_ENV).value(), Settings::Key::General_IP); + } else { + TryReadValue(data, "General", StrIP, EnvStrIP, Settings::Key::General_IP); + } TryReadValue(data, "General", StrMaxCars, EnvStrMaxCars, Settings::Key::General_MaxCars); TryReadValue(data, "General", StrMaxPlayers, EnvStrMaxPlayers, Settings::Key::General_MaxPlayers); TryReadValue(data, "General", StrMap, EnvStrMap, Settings::Key::General_Map);