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

fix plugins option in config file #1640

Closed
wants to merge 5 commits into from

Conversation

oxarbitrage
Copy link
Member

For issue #1637

This is option 1 of #1637 (comment) which i think is the way to go.

It works, plugins added to the config are not ignored with patch, command line haves preference when plugins is on both places, that looks ok to me.

The problem is that the plugins option is added at the end of the file, just before the loggers.

Ill keep researching to see if there is a way to add it in an arbitrary place.

@@ -127,6 +113,10 @@ int main(int argc, char** argv) {
return 0;
}

cfg_options.add_options()
("plugins", bpo::value<std::string>()->default_value(options.at("plugins").as<std::string>()),
"Space-separated list of plugins to activate");
Copy link
Member

Choose a reason for hiding this comment

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

What if we move this to be before auto witness_plug = node->register_plugin<witness_plugin::witness_plugin>();? I guess plugins will be be moved up a bit in config.ini.

Copy link
Member Author

Choose a reason for hiding this comment

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

that will put the plugin option at the top of the config file.

Copy link
Member Author

Choose a reason for hiding this comment

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

i think i have it, a bit dirty now so cleaning up, will commit in a bit.

Copy link
Member

Choose a reason for hiding this comment

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

Got it. Actually if we want plugins to be before plugin options and after other application options, we need to find a way to do it after

configuration_file_options.add_options()
("p2p-endpoint", bpo::value<string>(), "Endpoint for P2P node to listen on")
("seed-node,s", bpo::value<vector<string>>()->composing(),
"P2P nodes to connect to on startup (may specify multiple times)")
("seed-nodes", bpo::value<string>()->composing(),
"JSON array of P2P nodes to connect to on startup")
("checkpoint,c", bpo::value<vector<string>>()->composing(),
"Pairs of [BLOCK_NUM,BLOCK_ID] that should be enforced as checkpoints.")
("rpc-endpoint", bpo::value<string>()->implicit_value("127.0.0.1:8090"),
"Endpoint for websocket RPC to listen on")
("rpc-tls-endpoint", bpo::value<string>()->implicit_value("127.0.0.1:8089"),
"Endpoint for TLS websocket RPC to listen on")
("server-pem,p", bpo::value<string>()->implicit_value("server.pem"), "The TLS certificate file for this server")
("server-pem-password,P", bpo::value<string>()->implicit_value(""), "Password for this certificate")
("genesis-json", bpo::value<boost::filesystem::path>(), "File to read Genesis State from")
("dbg-init-key", bpo::value<string>(), "Block signing key to use for init witnesses, overrides genesis file")
("api-access", bpo::value<boost::filesystem::path>(), "JSON file specifying API permissions")
("io-threads", bpo::value<uint16_t>()->implicit_value(0), "Number of IO threads, default to 0 for auto-configuration")
("enable-subscribe-to-all", bpo::value<bool>()->implicit_value(true),
"Whether allow API clients to subscribe to universal object creation and removal events")
("enable-standby-votes-tracking", bpo::value<bool>()->implicit_value(true),
"Whether to enable tracking of votes of standby witnesses and committee members. "
"Set it to true to provide accurate data to API clients, set to false for slightly better performance.")
;
but before
configuration_file_options.add(_cfg_options);
.

Copy link
Member Author

Choose a reason for hiding this comment

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

it can be done in the binary if we first add the non plugin options, then load the plugins and add the options again for them as:

d060bbd

This way config will look as:

...
# Whether allow API clients to subscribe to universal object creation and removal events
# enable-subscribe-to-all = 

# Whether to enable tracking of votes of standby witnesses and committee members. Set it to true to provide accurate data to API clients, set to false for slightly better performance.
# enable-standby-votes-tracking = 

# Space-separated list of plugins to activate
plugins = witness account_history market_history grouped_orders

# Enable block production, even if the chain is stale.
enable-stale-production = false

# Percent of witnesses (0-99) that must be participating in order to produce blocks
required-participation = false
...

That is with plugins on top of the first witness plugin option.

Copy link
Member

Choose a reason for hiding this comment

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

Looks good. I don't know whether there are side effects.

@pmconrad
Copy link
Contributor

Looks a bit hackish but if it works it's ok I guess. We've had duplicate option names being mashed together before, so adding application options twice shouldn't hurt.

I suppose this needs to be fixed in delayed_node as well?

@@ -127,6 +103,25 @@ int main(int argc, char** argv) {
return 0;
}

cfg_options.add_options()
("plugins", bpo::value<std::string>()->default_value(options.at("plugins").as<std::string>()),
Copy link
Contributor

Choose a reason for hiding this comment

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

This is bad IMO, because it will take the options passed on the command line as default when writing a new config file.

Copy link
Member Author

Choose a reason for hiding this comment

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

agree and fixed. thank you.

@oxarbitrage oxarbitrage changed the base branch from develop to release March 12, 2019 19:57
@oxarbitrage oxarbitrage changed the base branch from release to develop March 12, 2019 19:58
@oxarbitrage
Copy link
Member Author

Replacing with #1647 as the patch will be released in the form of hotfix.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants