diff options
Diffstat (limited to 'src/daemon/command_line_args.h')
-rw-r--r-- | src/daemon/command_line_args.h | 41 |
1 files changed, 28 insertions, 13 deletions
diff --git a/src/daemon/command_line_args.h b/src/daemon/command_line_args.h index ee6167b6a..efbae488c 100644 --- a/src/daemon/command_line_args.h +++ b/src/daemon/command_line_args.h @@ -31,20 +31,35 @@ #include "common/command_line.h" #include "cryptonote_config.h" +#include "daemonizer/daemonizer.h" namespace daemon_args { std::string const WINDOWS_SERVICE_NAME = "Monero Daemon"; - const command_line::arg_descriptor<std::string> arg_config_file = { + const command_line::arg_descriptor<std::string, false, true> arg_config_file = { "config-file" , "Specify configuration file" - , std::string(CRYPTONOTE_NAME ".conf") + , (daemonizer::get_default_data_dir() / std::string(CRYPTONOTE_NAME ".conf")).string() + , cryptonote::arg_testnet_on + , [](bool testnet, bool defaulted, std::string val) { + if (testnet && defaulted) + return (daemonizer::get_default_data_dir() / "testnet" / + std::string(CRYPTONOTE_NAME ".conf")).string(); + return val; + } }; - const command_line::arg_descriptor<std::string> arg_log_file = { + const command_line::arg_descriptor<std::string, false, true> arg_log_file = { "log-file" , "Specify log file" - , "" + , (daemonizer::get_default_data_dir() / std::string(CRYPTONOTE_NAME ".log")).string() + , cryptonote::arg_testnet_on + , [](bool testnet, bool defaulted, std::string val) { + if (testnet && defaulted) + return (daemonizer::get_default_data_dir() / "testnet" / + std::string(CRYPTONOTE_NAME ".log")).string(); + return val; + } }; const command_line::arg_descriptor<std::size_t> arg_max_log_file_size = { "max-log-file-size" @@ -76,16 +91,16 @@ namespace daemon_args , "127.0.0.1" }; - const command_line::arg_descriptor<std::string> arg_zmq_rpc_bind_port = { + const command_line::arg_descriptor<std::string, false, true> arg_zmq_rpc_bind_port = { "zmq-rpc-bind-port" - , "Port for ZMQ RPC server to listen on" - , std::to_string(config::ZMQ_RPC_DEFAULT_PORT) - }; - - const command_line::arg_descriptor<std::string> arg_zmq_testnet_rpc_bind_port = { - "zmq-testnet-rpc-bind-port" - , "Port for testnet ZMQ RPC server to listen on" - , std::to_string(config::testnet::ZMQ_RPC_DEFAULT_PORT) + , "Port for ZMQ RPC server to listen on" + , std::to_string(config::ZMQ_RPC_DEFAULT_PORT) + , cryptonote::arg_testnet_on + , [](bool testnet, bool defaulted, std::string val) { + if (testnet && defaulted) + return std::to_string(config::testnet::ZMQ_RPC_DEFAULT_PORT); + return val; + } }; } // namespace daemon_args |