oxen-core/src/daemon/command_line_args.h
Jason Rhinelander 8913aecdb1 Config file migration fixes
The loki.conf -> oxen.conf migration wasn't working right when there is
also a ~/.loki -> ~/.oxen migration happening, so this rewrites it to
work properly:

- Make loki.conf -> oxen.conf migration leave behind a symlink
- Fix config file migration to also look for ~/.loki/loki.conf, and also
  consider ~/.loki/oxen.conf as a valid load source.  (The ~/.loki
  consideration only happens when data-dir is default *and* neither
  oxen.conf nor loki.conf are found in ~/.oxen).
- *Don't* look for ~/.loki/{loki,oxen}.conf if the default data dir
  (~/.oxen) exists.

Other changes:

- remove the default handling for the config file/log file and put it in
  main instead.  This is non-trivial, and the existing default is broken
  in that if you specify `--data-dir=blah` it still tries to load
  `~/.oxen/oxen.conf` rather than `blah/oxen.conf`.  With this commit it
  now does the expected thing when a data-dir is specified.
- Append /regtest to data-dir when running in --regtest mode.  The
  existing behaviour of clobbering the mainnet data dir is nasty.
2021-01-07 15:57:36 -04:00

77 lines
2.9 KiB
C++

// Copyright (c) 2018-2020, The Loki Project
// Copyright (c) 2014-2019, The Monero Project
//
// All rights reserved.
//
// Redistribution and use in source and binary forms, with or without modification, are
// permitted provided that the following conditions are met:
//
// 1. Redistributions of source code must retain the above copyright notice, this list of
// conditions and the following disclaimer.
//
// 2. Redistributions in binary form must reproduce the above copyright notice, this list
// of conditions and the following disclaimer in the documentation and/or other
// materials provided with the distribution.
//
// 3. Neither the name of the copyright holder nor the names of its contributors may be
// used to endorse or promote products derived from this software without specific
// prior written permission.
//
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY
// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
// MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL
// THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
// STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF
// THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#ifndef DAEMON_COMMAND_LINE_ARGS_H
#define DAEMON_COMMAND_LINE_ARGS_H
#include "common/command_line.h"
#include "cryptonote_config.h"
#include "daemonizer/daemonizer.h"
#include "cryptonote_core/cryptonote_core.h"
namespace daemon_args
{
const command_line::arg_descriptor<std::string> arg_config_file = {
"config-file",
"Specify configuration file",
"<data-dir>/" CRYPTONOTE_NAME ".conf"};
const command_line::arg_descriptor<std::string> arg_log_file = {
"log-file",
"Specify log file",
"<data-dir>/" CRYPTONOTE_NAME ".log"};
const command_line::arg_descriptor<std::size_t> arg_max_log_file_size = {
"max-log-file-size"
, "Specify maximum log file size [B]"
, MAX_LOG_FILE_SIZE
};
const command_line::arg_descriptor<std::size_t> arg_max_log_files = {
"max-log-files"
, "Specify maximum number of rotated log files to be saved (no limit by setting to 0)"
, MAX_LOG_FILES
};
const command_line::arg_descriptor<std::string> arg_log_level = {
"log-level"
, ""
, ""
};
const command_line::arg_descriptor<std::vector<std::string>> arg_command = {
"daemon_command"
, "Hidden"
};
const command_line::arg_descriptor<unsigned> arg_max_concurrency = {
"max-concurrency"
, "Max number of threads to use for a parallel job"
, 0
};
} // namespace daemon_args
#endif // DAEMON_COMMAND_LINE_ARGS_H