diff --git a/main.cpp b/main.cpp index 2431a40..1a73613 100644 --- a/main.cpp +++ b/main.cpp @@ -1,11 +1,9 @@ +#include "src/CmdLineOptions.h" #include "src/MicroCore.h" - #include "src/page.h" #include "ext/crow/crow.h" -#include "mstch/mstch.hpp" -#include "ext/format.h" #include @@ -19,7 +17,25 @@ namespace epee { } -int main() { +int main(int ac, const char* av[]) { + + // get command line options + xmreg::CmdLineOptions opts {ac, av}; + + auto help_opt = opts.get_option("help"); + + // if help was chosen, display help text and finish + if (*help_opt) + { + return 0; + } + + auto port_opt = opts.get_option("port"); + auto bc_path_opt = opts.get_option("bc-path"); + + + uint16_t app_port = boost::lexical_cast(*port_opt); + path blockchain_path {"/home/mwo/.bitmonero/lmdb"}; @@ -75,7 +91,7 @@ int main() { }); - app.port(8080).multithreaded().run(); + app.port(app_port).multithreaded().run(); // set timezone to orginal value if (tz_org != 0) diff --git a/src/CmdLineOptions.cpp b/src/CmdLineOptions.cpp index 07efea3..5c66053 100644 --- a/src/CmdLineOptions.cpp +++ b/src/CmdLineOptions.cpp @@ -23,16 +23,12 @@ namespace xmreg desc.add_options() ("help,h", value()->default_value(false)->implicit_value(true), "produce help message") - ("txhash,t", value(), - "transaction hash") - ("viewkey,v", value(), - "private view key string") - ("address,a", value(), - "monero address string") + ("port,p", value()->default_value("8081"), + "default port") ("bc-path,b", value(), "path to lmdb blockchain") - ("testnet", value()->default_value(false)->implicit_value(true), - "is the address from testnet network"); + ("deamon-url,d", value()->default_value("http:://127.0.0.1:18081"), + "monero address string"); store(command_line_parser(acc, avv) diff --git a/src/tools.h b/src/tools.h index 2c09868..4a258fd 100644 --- a/src/tools.h +++ b/src/tools.h @@ -19,9 +19,11 @@ #include "../ext/dateparser.h" #include "../ext/infix_iterator.h" +#include #include #include -#include "boost/date_time/posix_time/posix_time.hpp" +#include + #include #include