diff --git a/libraries/cli/include/cli/config.hpp b/libraries/cli/include/cli/config.hpp index 64550aaef3..39274545b7 100644 --- a/libraries/cli/include/cli/config.hpp +++ b/libraries/cli/include/cli/config.hpp @@ -50,6 +50,7 @@ class Config { static constexpr const char* CONFIG_COMMAND = "config"; static constexpr const char* BOOT_NODES = "boot-nodes"; static constexpr const char* PUBLIC_IP = "public-ip"; + static constexpr const char* PORT = "port"; static constexpr const char* LOG_CHANNELS = "log-channels"; static constexpr const char* LOG_CONFIGURATIONS = "log-configurations"; static constexpr const char* BOOT_NODES_APPEND = "boot-nodes-append"; diff --git a/libraries/cli/src/config.cpp b/libraries/cli/src/config.cpp index 252e68a987..6e5452c33c 100644 --- a/libraries/cli/src/config.cpp +++ b/libraries/cli/src/config.cpp @@ -26,6 +26,7 @@ Config::Config(int argc, const char* argv[]) { std::vector command; std::vector boot_nodes; std::string public_ip; + uint16_t port = 0; std::vector log_channels; std::vector log_configurations; std::vector boot_nodes_append; @@ -105,6 +106,8 @@ Config::Config(int argc, const char* argv[]) { "Boot nodes to connect to in addition to boot nodes defined in config: [ip_address:port_number/node_id, ....]"); node_command_options.add_options()(PUBLIC_IP, bpo::value(&public_ip), "Force advertised public IP to the given IP (default: auto)"); + node_command_options.add_options()(PORT, bpo::value(&port), + "Listen on the given port for incoming connections"); node_command_options.add_options()(LOG_CHANNELS, bpo::value>(&log_channels)->multitoken(), "Log channels to log: [channel:level, ....]"); node_command_options.add_options()( @@ -258,6 +261,9 @@ Config::Config(int argc, const char* argv[]) { if (!public_ip.empty()) { node_config_.network.public_ip = public_ip; } + if (port) { + node_config_.network.listen_port = port; + } node_config_.db_config.db_revert_to_period = revert_to_period; node_config_.db_config.rebuild_db = rebuild_db; node_config_.db_config.rebuild_db_columns = rebuild_db_columns; diff --git a/programs/taraxa-bootnode/main.cpp b/programs/taraxa-bootnode/main.cpp index 78594aecd4..2bd427fabd 100644 --- a/programs/taraxa-bootnode/main.cpp +++ b/programs/taraxa-bootnode/main.cpp @@ -90,7 +90,7 @@ int main(int argc, char** argv) { auto addNetworkingOption = client_networking.add_options(); addNetworkingOption("public-ip", po::value()->value_name(""), "Force advertised public IP to the given IP (default: auto)"); - addNetworkingOption("listen-ip", po::value()->value_name("(:)"), + addNetworkingOption("listen-ip", po::value()->value_name(""), "Listen on the given IP for incoming connections (default: 0.0.0.0)"); addNetworkingOption("listen", po::value()->value_name(""), "Listen on the given port for incoming connections (default: 10002)");