Skip to content

Commit

Permalink
Add warning if MQTT_SERVER_PORT is not set to number
Browse files Browse the repository at this point in the history
Signed-off-by: Cornelius Claussen <cc@pionix.de>
  • Loading branch information
corneliusclaussen committed Jun 22, 2024
1 parent 34d0b10 commit 61c815a
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion lib/runtime.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -315,8 +315,13 @@ RuntimeSettings::RuntimeSettings(const std::string& prefix_, const std::string&
// overwrite mqtt broker port with environment variable
// NOLINTNEXTLINE(concurrency-mt-unsafe): not problematic that this function is not threadsafe here
const char* mqtt_server_port = std::getenv("MQTT_SERVER_PORT");

if (mqtt_server_port != nullptr) {
mqtt_broker_port = std::stoi(mqtt_server_port);
try {
mqtt_broker_port = std::stoi(mqtt_server_port);
} catch (...) {
EVLOG_warning << "Environment variable MQTT_SERVER_PORT set, but not set to an integer. Ignoring.";
}
}

const auto settings_mqtt_everest_prefix_it = settings.find("mqtt_everest_prefix");
Expand Down

0 comments on commit 61c815a

Please sign in to comment.