Add websocket port argument (#355)

This commit is contained in:
Jure Bajic
2022-02-17 10:27:24 +01:00
committed by Antonio Andelic
parent 1d88893715
commit 3fb7e5378d
5 changed files with 31 additions and 15 deletions

View File

@@ -132,8 +132,15 @@ std::optional<Enum> StringToEnum(const auto &value, const auto &mappings) {
// Bolt server flags.
DEFINE_string(bolt_address, "0.0.0.0", "IP address on which the Bolt server should listen.");
// NOLINTNEXTLINE(cppcoreguidelines-avoid-non-const-global-variables)
DEFINE_string(monitoring_address, "0.0.0.0",
"IP address on which the websocket server for Memgraph monitoring should listen.");
DEFINE_VALIDATED_int32(bolt_port, 7687, "Port on which the Bolt server should listen.",
FLAG_IN_RANGE(0, std::numeric_limits<uint16_t>::max()));
// NOLINTNEXTLINE(cppcoreguidelines-avoid-non-const-global-variables)
DEFINE_VALIDATED_int32(monitoring_port, 7444,
"Port on which the websocket server for Memgraph monitoring should listen.",
FLAG_IN_RANGE(0, std::numeric_limits<uint16_t>::max()));
DEFINE_VALIDATED_int32(bolt_num_workers, std::max(std::thread::hardware_concurrency(), 1U),
"Number of workers used by the Bolt server. By default, this will be the "
"number of processing units available on the machine.",
@@ -1216,7 +1223,8 @@ int main(int argc, char **argv) {
}
communication::websocket::SafeAuth websocket_auth{&auth};
communication::websocket::Server websocket_server{{"0.0.0.0", 7444}, &context, websocket_auth};
communication::websocket::Server websocket_server{
{FLAGS_monitoring_address, static_cast<uint16_t>(FLAGS_monitoring_port)}, &context, websocket_auth};
AddLoggerSink(websocket_server.GetLoggingSink());
// Handler for regular termination signals