mirror of
https://github.com/BeamMP/BeamMP-Server.git
synced 2025-07-01 23:35:41 +00:00
add BEAMMP_PROVIDER_PORT_ENV to allow provider to change which ENV
variable the port is fetched from
This commit is contained in:
parent
03d91b1f4d
commit
6f50cad76b
@ -26,6 +26,7 @@ enum class Key {
|
||||
// provider settings
|
||||
PROVIDER_UPDATE_MESSAGE,
|
||||
PROVIDER_DISABLE_CONFIG,
|
||||
PROVIDER_PORT_ENV,
|
||||
};
|
||||
|
||||
std::optional<std::string> Get(Key key);
|
||||
|
@ -36,6 +36,9 @@ std::string_view Env::ToString(Env::Key key) {
|
||||
case Key::PROVIDER_DISABLE_CONFIG:
|
||||
return "BEAMMP_PROVIDER_DISABLE_CONFIG";
|
||||
break;
|
||||
case Key::PROVIDER_PORT_ENV:
|
||||
return "BEAMMP_PROVIDER_PORT_ENV";
|
||||
break;
|
||||
}
|
||||
return "";
|
||||
}
|
||||
|
@ -234,7 +234,11 @@ void TConfig::ParseFromFile(std::string_view name) {
|
||||
// GENERAL
|
||||
TryReadValue(data, "General", StrDebug, EnvStrDebug, Application::Settings.DebugModeEnabled);
|
||||
TryReadValue(data, "General", StrPrivate, EnvStrPrivate, Application::Settings.Private);
|
||||
if (Env::Get(Env::Key::PROVIDER_PORT_ENV).has_value()) {
|
||||
TryReadValue(data, "General", StrPort, Env::Get(Env::Key::PROVIDER_PORT_ENV).value(), Application::Settings.Port);
|
||||
} else {
|
||||
TryReadValue(data, "General", StrPort, EnvStrPort, Application::Settings.Port);
|
||||
}
|
||||
TryReadValue(data, "General", StrMaxCars, EnvStrMaxCars, Application::Settings.MaxCars);
|
||||
TryReadValue(data, "General", StrMaxPlayers, EnvStrMaxPlayers, Application::Settings.MaxPlayers);
|
||||
TryReadValue(data, "General", StrMap, EnvStrMap, Application::Settings.MapName);
|
||||
|
Loading…
x
Reference in New Issue
Block a user