// // Created by mwo on 6/11/15. // #include "CmdLineOptions.h" namespace xmreg { /** * Take the acc and *avv[] from the main() and check and parse * all the options given */ CmdLineOptions::CmdLineOptions(int acc, const char *avv[]) { positional_options_description p; p.add("txhash", -1); options_description desc( "xmrblocks, Wownero Blockchain Explorer"); desc.add_options() ("help,h", value()->default_value(false)->implicit_value(true), "produce help message") ("testnet,t", value()->default_value(false)->implicit_value(true), "use testnet blockchain") ("stagenet,s", value()->default_value(false)->implicit_value(true), "use stagenet blockchain") ("enable-pusher", value()->default_value(false)->implicit_value(true), "enable signed transaction pusher") ("enable-randomx", value()->default_value(false)->implicit_value(true), "enable generation of randomx code") ("enable-mixin-details", value()->default_value(false)->implicit_value(true), "enable mixin details for key images, e.g., timescale, mixin of mixins, in tx context") ("enable-key-image-checker", value()->default_value(false)->implicit_value(true), "enable key images file checker") ("enable-output-key-checker", value()->default_value(false)->implicit_value(true), "enable outputs key file checker") ("enable-json-api", value()->default_value(false)->implicit_value(true), "enable JSON REST api") ("enable-as-hex", value()->default_value(false)->implicit_value(true), "enable links to provide hex represtations of a tx and a block") ("enable-autorefresh-option", value()->default_value(false)->implicit_value(true), "enable users to have the index page on autorefresh") ("enable-emission-monitor", value()->default_value(false)->implicit_value(true), "enable Wownero total emission monitoring thread") ("port,p", value()->default_value("8081"), "default explorer port") ("bindaddr,x", value()->default_value("0.0.0.0"), "default bind address for the explorer") ("testnet-url", value()->default_value(""), "you can specify testnet url, if you run it on mainnet or stagenet. link will show on front page to testnet explorer") ("stagenet-url", value()->default_value(""), "you can specify stagenet url, if you run it on mainnet or testnet. link will show on front page to stagenet explorer") ("mainnet-url", value()->default_value(""), "you can specify mainnet url, if you run it on testnet or stagenet. link will show on front page to mainnet explorer") ("no-blocks-on-index", value()->default_value("10"), "number of last blocks to be shown on index page") ("mempool-info-timeout", value()->default_value("5000"), "maximum time, in milliseconds, to wait for mempool data for the front page") ("mempool-refresh-time", value()->default_value("5"), "time, in seconds, for each refresh of mempool state") ("concurrency,c", value()->default_value(0), "number of threads handling http queries. Default is 0 which means it is based you on the cpu") ("bc-path,b", value(), "path to lmdb folder of the blockchain, e.g., ~/.wownero/lmdb") ("ssl-crt-file", value(), "path to crt file for ssl (https) functionality") ("ssl-key-file", value(), "path to key file for ssl (https) functionality") ("daemon-login", value(), "Specify username[:password] for daemon RPC client") ("deamon-url,d", value()->default_value("http:://127.0.0.1:18081"), "Monero daemon url"); store(command_line_parser(acc, avv) .options(desc) .positional(p) .run(), vm); notify(vm); if (vm.count("help")) { if (vm["help"].as()) cout << desc << "\n"; } } /** * Return the value of the argument passed to the program * in wrapped around boost::optional */ template boost::optional CmdLineOptions::get_option(const string & opt_name) const { if (!vm.count(opt_name)) { return boost::none; } return vm[opt_name].as(); } // explicit instantiations of get_option template function template boost::optional CmdLineOptions::get_option(const string & opt_name) const; template boost::optional CmdLineOptions::get_option(const string & opt_name) const; template boost::optional CmdLineOptions::get_option(const string & opt_name) const; }