Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add --rpcconfig option and fix wallet config bug #3069

Merged
merged 1 commit into from
Jan 26, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion nano/nano_node/daemon.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@ void nano_daemon::daemon::run (boost::filesystem::path const & data_path, nano::
{
// Launch rpc in-process
nano::rpc_config rpc_config;
auto error = nano::read_rpc_config_toml (data_path, rpc_config);
auto error = nano::read_rpc_config_toml (data_path, rpc_config, flags.rpc_config_overrides);
if (error)
{
std::cout << error.get_message () << std::endl;
Expand Down
1 change: 1 addition & 0 deletions nano/nano_node/entry.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,7 @@ int main (int argc, char * const * argv)
("help", "Print out options")
("version", "Prints out version")
("config", boost::program_options::value<std::vector<nano::config_key_value_pair>>()->multitoken(), "Pass node configuration values. This takes precedence over any values in the configuration file. This option can be repeated multiple times.")
("rpcconfig", boost::program_options::value<std::vector<nano::config_key_value_pair>>()->multitoken(), "Pass RPC configuration values. This takes precedence over any values in the RPC configuration file. This option can be repeated multiple times.")
("daemon", "Start node daemon")
("compare_rep_weights", "Display a summarized comparison between the hardcoded bootstrap weights and representative weights from the ledger. Full comparison is output to logs")
("debug_block_count", "Display the number of blocks")
Expand Down
12 changes: 4 additions & 8 deletions nano/nano_wallet/entry.cpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
#include <nano/boost/process/child.hpp>
#include <nano/crypto_lib/random_pool.hpp>
#include <nano/lib/cli.hpp>
#include <nano/lib/errors.hpp>
#include <nano/lib/rpcconfig.hpp>
#include <nano/lib/threading.hpp>
Expand Down Expand Up @@ -176,7 +177,7 @@ int run_wallet (QApplication & application, int argc, char * const * argv, boost
{
// Launch rpc in-process
nano::rpc_config rpc_config;
auto error = nano::read_rpc_config_toml (data_path, rpc_config);
auto error = nano::read_rpc_config_toml (data_path, rpc_config, flags.rpc_config_overrides);
if (error)
{
show_error (error.get_message ());
Expand Down Expand Up @@ -256,7 +257,8 @@ int main (int argc, char * const * argv)
// clang-format off
description.add_options()
("help", "Print out options")
("config", boost::program_options::value<std::vector<std::string>>()->multitoken(), "Pass configuration values. This takes precedence over any values in the node configuration file. This option can be repeated multiple times.");
("config", boost::program_options::value<std::vector<nano::config_key_value_pair>>()->multitoken(), "Pass configuration values. This takes precedence over any values in the node configuration file. This option can be repeated multiple times.")
("rpcconfig", boost::program_options::value<std::vector<nano::config_key_value_pair>>()->multitoken(), "Pass RPC configuration values. This takes precedence over any values in the RPC configuration file. This option can be repeated multiple times.");
nano::add_node_flag_options (description);
nano::add_node_options (description);
// clang-format on
Expand Down Expand Up @@ -292,12 +294,6 @@ int main (int argc, char * const * argv)
}
}

std::vector<std::string> config_overrides;
if (vm.count ("config"))
{
config_overrides = vm["config"].as<std::vector<std::string>> ();
}

auto ec = nano::handle_node_options (vm);
if (ec == nano::error_cli::unknown_command)
{
Expand Down
5 changes: 5 additions & 0 deletions nano/node/cli.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -177,6 +177,11 @@ std::error_code nano::update_flags (nano::node_flags & flags_a, boost::program_o
{
flags_a.config_overrides = nano::config_overrides (config->second.as<std::vector<nano::config_key_value_pair>> ());
}
auto rpcconfig (vm.find ("rpcconfig"));
if (rpcconfig != vm.end ())
{
flags_a.rpc_config_overrides = nano::config_overrides (rpcconfig->second.as<std::vector<nano::config_key_value_pair>> ());
}
return ec;
}

Expand Down
1 change: 1 addition & 0 deletions nano/node/nodeconfig.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -120,6 +120,7 @@ class node_flags final
{
public:
std::vector<std::string> config_overrides;
std::vector<std::string> rpc_config_overrides;
bool disable_backup{ false };
bool disable_lazy_bootstrap{ false };
bool disable_legacy_bootstrap{ false };
Expand Down