Allow CLI --config values for inactive node tests (#2594)
This commit is contained in:
parent
5dac531c91
commit
90f1c862a8
4 changed files with 27 additions and 14 deletions
|
@ -155,11 +155,6 @@ int main (int argc, char * const * argv)
|
|||
std::cerr << flags_ec.message () << std::endl;
|
||||
std::exit (1);
|
||||
}
|
||||
auto config (vm.find ("config"));
|
||||
if (config != vm.end ())
|
||||
{
|
||||
flags.config_overrides = config->second.as<std::vector<std::string>> ();
|
||||
}
|
||||
daemon.run (data_path, flags);
|
||||
}
|
||||
else if (vm.count ("debug_block_count"))
|
||||
|
|
|
@ -64,7 +64,7 @@ nano::error read_wallet_config (nano::wallet_config & config_a, boost::filesyste
|
|||
}
|
||||
}
|
||||
|
||||
int run_wallet (QApplication & application, int argc, char * const * argv, boost::filesystem::path const & data_path, std::vector<std::string> const & config_overrides, nano::node_flags const & flags)
|
||||
int run_wallet (QApplication & application, int argc, char * const * argv, boost::filesystem::path const & data_path, nano::node_flags const & flags)
|
||||
{
|
||||
int result (0);
|
||||
nano_qt::eventloop_processor processor;
|
||||
|
@ -81,7 +81,7 @@ int run_wallet (QApplication & application, int argc, char * const * argv, boost
|
|||
nano::daemon_config config (data_path);
|
||||
nano::wallet_config wallet_config;
|
||||
|
||||
auto error = nano::read_node_config_toml (data_path, config, config_overrides);
|
||||
auto error = nano::read_node_config_toml (data_path, config, flags.config_overrides);
|
||||
if (!error)
|
||||
{
|
||||
error = read_wallet_config (wallet_config, data_path);
|
||||
|
@ -331,12 +331,7 @@ int main (int argc, char * const * argv)
|
|||
{
|
||||
throw std::runtime_error (flags_ec.message ());
|
||||
}
|
||||
auto config (vm.find ("config"));
|
||||
if (config != vm.end ())
|
||||
{
|
||||
flags.config_overrides = config->second.as<std::vector<std::string>> ();
|
||||
}
|
||||
result = run_wallet (application, argc, argv, data_path, config_overrides, flags);
|
||||
result = run_wallet (application, argc, argv, data_path, flags);
|
||||
}
|
||||
catch (std::exception const & e)
|
||||
{
|
||||
|
|
|
@ -169,6 +169,12 @@ std::error_code nano::update_flags (nano::node_flags & flags_a, boost::program_o
|
|||
{
|
||||
flags_a.vote_processor_capacity = vote_processor_capacity_it->second.as<size_t> ();
|
||||
}
|
||||
// Config overriding
|
||||
auto config (vm.find ("config"));
|
||||
if (config != vm.end ())
|
||||
{
|
||||
flags_a.config_overrides = config->second.as<std::vector<std::string>> ();
|
||||
}
|
||||
return ec;
|
||||
}
|
||||
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
#include <nano/lib/threading.hpp>
|
||||
#include <nano/lib/tomlconfig.hpp>
|
||||
#include <nano/lib/utility.hpp>
|
||||
#include <nano/node/common.hpp>
|
||||
#include <nano/node/node.hpp>
|
||||
|
@ -1355,7 +1356,23 @@ peering_port (peering_port_a)
|
|||
nano::set_secure_perm_directory (path, error_chmod);
|
||||
logging.max_size = std::numeric_limits<std::uintmax_t>::max ();
|
||||
logging.init (path);
|
||||
node = std::make_shared<nano::node> (*io_context, peering_port, path, alarm, logging, work, node_flags);
|
||||
// Config overriding
|
||||
nano::node_config config (peering_port, logging);
|
||||
std::stringstream config_overrides_stream;
|
||||
for (auto const & entry : node_flags.config_overrides)
|
||||
{
|
||||
config_overrides_stream << entry << std::endl;
|
||||
}
|
||||
config_overrides_stream << std::endl;
|
||||
nano::tomlconfig toml;
|
||||
toml.read (config_overrides_stream);
|
||||
auto error = config.deserialize_toml (toml);
|
||||
if (error)
|
||||
{
|
||||
std::cerr << "Error deserializing --config option" << std::endl;
|
||||
std::exit (1);
|
||||
}
|
||||
node = std::make_shared<nano::node> (*io_context, path, alarm, config, work, node_flags);
|
||||
node->active.stop ();
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue