aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--src/cryptonote_core/cryptonote_core.cpp8
-rw-r--r--src/daemon/command_line_args.h31
-rw-r--r--src/daemon/main.cpp9
-rw-r--r--src/p2p/net_node.cpp8
-rw-r--r--src/rpc/core_rpc_server.cpp8
5 files changed, 45 insertions, 19 deletions
diff --git a/src/cryptonote_core/cryptonote_core.cpp b/src/cryptonote_core/cryptonote_core.cpp
index f5434fef4..64c14f7a2 100644
--- a/src/cryptonote_core/cryptonote_core.cpp
+++ b/src/cryptonote_core/cryptonote_core.cpp
@@ -74,9 +74,13 @@ namespace cryptonote
const command_line::arg_descriptor<std::string, false, true> arg_data_dir = {
"data-dir"
, "Specify data directory"
- , arg_testnet_on
- , (boost::filesystem::path(tools::get_default_data_dir()) / "testnet").string()
, tools::get_default_data_dir()
+ , arg_testnet_on
+ , [](bool testnet, bool defaulted, std::string val) {
+ if (testnet)
+ return (boost::filesystem::path(val) / "testnet").string();
+ return val;
+ }
};
const command_line::arg_descriptor<bool> arg_offline = {
"offline"
diff --git a/src/daemon/command_line_args.h b/src/daemon/command_line_args.h
index 90093b65e..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"
@@ -79,9 +94,13 @@ namespace daemon_args
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"
- , cryptonote::arg_testnet_on
- , std::to_string(config::testnet::ZMQ_RPC_DEFAULT_PORT)
, 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
diff --git a/src/daemon/main.cpp b/src/daemon/main.cpp
index bef3b1a75..752a92ba4 100644
--- a/src/daemon/main.cpp
+++ b/src/daemon/main.cpp
@@ -73,20 +73,15 @@ int main(int argc, char const * argv[])
po::options_description core_settings("Settings");
po::positional_options_description positional_options;
{
- bf::path default_data_dir = daemonizer::get_default_data_dir();
- bf::path default_testnet_data_dir = {default_data_dir / "testnet"};
-
// Misc Options
command_line::add_arg(visible_options, command_line::arg_help);
command_line::add_arg(visible_options, command_line::arg_version);
command_line::add_arg(visible_options, daemon_args::arg_os_version);
- bf::path default_conf = default_data_dir / std::string(CRYPTONOTE_NAME ".conf");
- command_line::add_arg(visible_options, daemon_args::arg_config_file, default_conf.string());
+ command_line::add_arg(visible_options, daemon_args::arg_config_file);
// Settings
- bf::path default_log = default_data_dir / std::string(CRYPTONOTE_NAME ".log");
- command_line::add_arg(core_settings, daemon_args::arg_log_file, default_log.string());
+ command_line::add_arg(core_settings, daemon_args::arg_log_file);
command_line::add_arg(core_settings, daemon_args::arg_log_level);
command_line::add_arg(core_settings, daemon_args::arg_max_log_file_size);
command_line::add_arg(core_settings, daemon_args::arg_max_concurrency);
diff --git a/src/p2p/net_node.cpp b/src/p2p/net_node.cpp
index 21a7fb50c..170b79984 100644
--- a/src/p2p/net_node.cpp
+++ b/src/p2p/net_node.cpp
@@ -37,9 +37,13 @@ namespace nodetool
const command_line::arg_descriptor<std::string, false, true> arg_p2p_bind_port = {
"p2p-bind-port"
, "Port for p2p network protocol"
- , cryptonote::arg_testnet_on
- , std::to_string(config::testnet::P2P_DEFAULT_PORT)
, std::to_string(config::P2P_DEFAULT_PORT)
+ , cryptonote::arg_testnet_on
+ , [](bool testnet, bool defaulted, std::string val) {
+ if (testnet && defaulted)
+ return std::to_string(config::testnet::P2P_DEFAULT_PORT);
+ return val;
+ }
};
const command_line::arg_descriptor<uint32_t> arg_p2p_external_port = {"p2p-external-port", "External port for p2p network protocol (if port forwarding used with NAT)", 0};
const command_line::arg_descriptor<bool> arg_p2p_allow_local_ip = {"allow-local-ip", "Allow local ip add to peer list, mostly in debug purposes"};
diff --git a/src/rpc/core_rpc_server.cpp b/src/rpc/core_rpc_server.cpp
index 4eab9b6d9..a8d801ac7 100644
--- a/src/rpc/core_rpc_server.cpp
+++ b/src/rpc/core_rpc_server.cpp
@@ -2076,9 +2076,13 @@ namespace cryptonote
const command_line::arg_descriptor<std::string, false, true> core_rpc_server::arg_rpc_bind_port = {
"rpc-bind-port"
, "Port for RPC server"
- , cryptonote::arg_testnet_on
- , std::to_string(config::testnet::RPC_DEFAULT_PORT)
, std::to_string(config::RPC_DEFAULT_PORT)
+ , cryptonote::arg_testnet_on
+ , [](bool testnet, bool defaulted, std::string val) {
+ if (testnet && defaulted)
+ return std::to_string(config::testnet::RPC_DEFAULT_PORT);
+ return val;
+ }
};
const command_line::arg_descriptor<std::string> core_rpc_server::arg_rpc_restricted_bind_port = {