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] 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);