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

move --plugins from application to binary #1427 #1437

Merged
merged 16 commits into from
Jan 20, 2019
Merged
Changes from 1 commit
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
23 changes: 18 additions & 5 deletions programs/delayed_node/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -66,13 +66,15 @@ int main(int argc, char** argv) {
app_options.add_options()
("help,h", "Print this help message and exit.")
("data-dir,d", bpo::value<boost::filesystem::path>()->default_value("delayed_node_data_dir"), "Directory containing databases, configuration file, etc.")
("plugins", bpo::value<std::string>()->default_value("delayed_node account_history market_history"),
"Space-separated list of plugins to activate");
;

bpo::variables_map options;

auto delayed_plug = node.register_plugin<delayed_node::delayed_node_plugin>(true);
auto history_plug = node.register_plugin<account_history::account_history_plugin>(true);
auto market_history_plug = node.register_plugin<market_history::market_history_plugin>(true);
auto delayed_plug = node.register_plugin<delayed_node::delayed_node_plugin>();
auto history_plug = node.register_plugin<account_history::account_history_plugin>();
auto market_history_plug = node.register_plugin<market_history::market_history_plugin>();

try
{
Expand Down Expand Up @@ -160,9 +162,20 @@ int main(int argc, char** argv) {
elog("Error parsing configuration file: ${e}", ("e", e.what()));
return 1;
}
if( !options.count("plugins") )
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You should keep the "plugins" option. We don't want to change the behaviour of the executable.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this is done 1326a5c

options.insert( std::make_pair( "plugins", bpo::variable_value(std::string("delayed_node account_history market_history"), true) ) );

std::set<std::string> plugins;
boost::split(plugins, options.at("plugins").as<std::string>(), [](char c){return c == ' ';});

if(plugins.count("account_history") && plugins.count("elasticsearch")) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This check is useless. Elasticsearch is not available in delayed_node.

std::cerr << "Plugin conflict: Cannot load both account_history plugin and elasticsearch plugin\n";
return 1;
}

std::for_each(plugins.begin(), plugins.end(), [&](const std::string& plug) mutable {
if (!plug.empty()) {
node.enable_plugin(plug);
}
});
node.initialize(data_dir, options);
node.initialize_plugins( options );

Expand Down