mirror of
https://github.com/XRPLF/rippled.git
synced 2025-12-06 17:27:55 +00:00
Compare commits
56 Commits
bthomee/re
...
bthomee/re
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
94c0949df3 | ||
|
|
79a82c9c55 | ||
|
|
3b45ed8f5a | ||
|
|
c40c939a16 | ||
|
|
68faad9e33 | ||
|
|
91da840760 | ||
|
|
90cbab8ead | ||
|
|
03f9873b6c | ||
|
|
8527bf568d | ||
|
|
f1b283f63e | ||
|
|
a765784c49 | ||
|
|
037f54a4d5 | ||
|
|
4cae198dca | ||
|
|
f77dc6cefc | ||
|
|
9816765706 | ||
|
|
4d58bb1cc9 | ||
|
|
cb9d7e6b14 | ||
|
|
cc8c465267 | ||
|
|
7b1d653191 | ||
|
|
b8e676898e | ||
|
|
80b1c7114c | ||
|
|
f1a0d141b3 | ||
|
|
81e715a68d | ||
|
|
fafe87f547 | ||
|
|
1ba1ca775b | ||
|
|
96732f8b4c | ||
|
|
13c3d28568 | ||
|
|
45dd129f83 | ||
|
|
b516a17cac | ||
|
|
972ddde705 | ||
|
|
487bc23e23 | ||
|
|
fe515e8ab4 | ||
|
|
dc966e8a4d | ||
|
|
bf6308cb4e | ||
|
|
36ad664623 | ||
|
|
296f82629a | ||
|
|
808dcfb389 | ||
|
|
115f01978d | ||
|
|
4af408fcd6 | ||
|
|
b50bd88aba | ||
|
|
ac7cd17472 | ||
|
|
fc33a8e0ce | ||
|
|
154d6fa740 | ||
|
|
594b81bd72 | ||
|
|
cbc69ed62f | ||
|
|
613954184a | ||
|
|
18c459f903 | ||
|
|
56ac3a7323 | ||
|
|
5bf234337e | ||
|
|
b985a108cb | ||
|
|
ec128fe1e1 | ||
|
|
c420ceb84a | ||
|
|
e0691144ae | ||
|
|
1570e2e057 | ||
|
|
e7c72f0c05 | ||
|
|
656d4b4100 |
4
.github/scripts/rename/README.md
vendored
4
.github/scripts/rename/README.md
vendored
@@ -31,6 +31,9 @@ run from the repository root.
|
||||
the `xrpld` binary.
|
||||
5. `.github/scripts/rename/namespace.sh`: This script will rename the C++
|
||||
namespaces from `ripple` to `xrpl`.
|
||||
6. `.github/scripts/rename/config.sh`: This script will rename the config from
|
||||
`rippled.cfg` to `xrpld.cfg`, and updating the code accordingly. The old
|
||||
filename will still be accepted.
|
||||
|
||||
You can run all these scripts from the repository root as follows:
|
||||
|
||||
@@ -40,4 +43,5 @@ You can run all these scripts from the repository root as follows:
|
||||
./.github/scripts/rename/cmake.sh .
|
||||
./.github/scripts/rename/binary.sh .
|
||||
./.github/scripts/rename/namespace.sh .
|
||||
./.github/scripts/rename/config.sh .
|
||||
```
|
||||
|
||||
62
.github/scripts/rename/config.sh
vendored
Executable file
62
.github/scripts/rename/config.sh
vendored
Executable file
@@ -0,0 +1,62 @@
|
||||
#!/bin/bash
|
||||
|
||||
# Exit the script as soon as an error occurs.
|
||||
set -e
|
||||
|
||||
# On MacOS, ensure that GNU sed is installed and available as `gsed`.
|
||||
SED_COMMAND=sed
|
||||
if [[ "${OSTYPE}" == 'darwin'* ]]; then
|
||||
if ! command -v gsed &> /dev/null; then
|
||||
echo "Error: gsed is not installed. Please install it using 'brew install gnu-sed'."
|
||||
exit 1
|
||||
fi
|
||||
SED_COMMAND=gsed
|
||||
fi
|
||||
|
||||
# This script renames the config from `rippled.cfg` to `xrpld.cfg`, and updates
|
||||
# the code accordingly. The old filename will still be accepted.
|
||||
# Usage: .github/scripts/rename/config.sh <repository directory>
|
||||
|
||||
if [ "$#" -ne 1 ]; then
|
||||
echo "Usage: $0 <repository directory>"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
DIRECTORY=$1
|
||||
echo "Processing directory: ${DIRECTORY}"
|
||||
if [ ! -d "${DIRECTORY}" ]; then
|
||||
echo "Error: Directory '${DIRECTORY}' does not exist."
|
||||
exit 1
|
||||
fi
|
||||
pushd ${DIRECTORY}
|
||||
|
||||
# Add the xrpld.cfg to the .gitignore.
|
||||
if ! grep -q 'xrpld.cfg' .gitignore; then
|
||||
${SED_COMMAND} -i '/rippled.cfg/a\
|
||||
xrpld.cfg' .gitignore
|
||||
fi
|
||||
|
||||
# Rename the files.
|
||||
if [ -e rippled.cfg ]; then
|
||||
mv rippled.cfg xrpld.cfg
|
||||
fi
|
||||
if [ -e cfg/rippled-example.cfg ]; then
|
||||
mv cfg/rippled-example.cfg cfg/xrpld-example.cfg
|
||||
fi
|
||||
|
||||
# Rename inside the files.
|
||||
DIRECTORIES=("cfg" "cmake" "include" "src")
|
||||
for DIRECTORY in "${DIRECTORIES[@]}"; do
|
||||
echo "Processing directory: ${DIRECTORY}"
|
||||
|
||||
find "${DIRECTORY}" -type f \( -name "*.h" -o -name "*.hpp" -o -name "*.ipp" -o -name "*.cpp" -o -name "*.cmake" -o -name "*.txt" -o -name "*.cfg" -o -name "*.md" \) | while read -r FILE; do
|
||||
echo "Processing file: ${FILE}"
|
||||
${SED_COMMAND} -i -E 's/rippled(-example)?[ .]cfg/xrpld\1.cfg/g' "${FILE}"
|
||||
done
|
||||
done
|
||||
|
||||
# Restore the old config file name in the code that maintains support for now.
|
||||
${SED_COMMAND} -i 's/configLegacyName = "xrpld.cfg"/configLegacyName = "rippled.cfg"/g' src/xrpld/core/detail/Config.cpp
|
||||
|
||||
popd
|
||||
echo "Renaming complete."
|
||||
2
.github/workflows/reusable-check-rename.yml
vendored
2
.github/workflows/reusable-check-rename.yml
vendored
@@ -29,6 +29,8 @@ jobs:
|
||||
run: .github/scripts/rename/binary.sh .
|
||||
- name: Check namespaces
|
||||
run: .github/scripts/rename/namespace.sh .
|
||||
- name: Check config name
|
||||
run: .github/scripts/rename/config.sh .
|
||||
- name: Check for differences
|
||||
env:
|
||||
MESSAGE: |
|
||||
|
||||
1
.gitignore
vendored
1
.gitignore
vendored
@@ -54,6 +54,7 @@ debug_log.txt
|
||||
|
||||
# Ignore customized configs
|
||||
rippled.cfg
|
||||
xrpld.cfg
|
||||
validators.txt
|
||||
|
||||
# Doxygen generated documentation output
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
#
|
||||
# Default validators.txt
|
||||
#
|
||||
# This file is located in the same folder as your rippled.cfg file
|
||||
# This file is located in the same folder as your xrpld.cfg file
|
||||
# and defines which validators your server trusts not to collude.
|
||||
#
|
||||
# This file is UTF-8 with DOS, UNIX, or Mac style line endings.
|
||||
|
||||
@@ -33,14 +33,14 @@
|
||||
# configuration options. When the rippled server instance is launched, it
|
||||
# looks for a file with the following name:
|
||||
#
|
||||
# rippled.cfg
|
||||
# xrpld.cfg
|
||||
#
|
||||
# For more information on where the rippled server instance searches for the
|
||||
# file, visit:
|
||||
#
|
||||
# https://xrpl.org/commandline-usage.html#generic-options
|
||||
#
|
||||
# This file should be named rippled.cfg. This file is UTF-8 with DOS, UNIX,
|
||||
# This file should be named xrpld.cfg. This file is UTF-8 with DOS, UNIX,
|
||||
# or Mac style end of lines. Blank lines and lines beginning with '#' are
|
||||
# ignored. Undefined sections are reserved. No escapes are currently defined.
|
||||
#
|
||||
@@ -745,7 +745,7 @@
|
||||
#
|
||||
# Specify the file by its name or path.
|
||||
# Unless an absolute path is specified, it will be considered relative to
|
||||
# the folder in which the rippled.cfg file is located.
|
||||
# the folder in which the xrpld.cfg file is located.
|
||||
#
|
||||
# Examples:
|
||||
# /home/ripple/validators.txt
|
||||
@@ -902,7 +902,7 @@
|
||||
# the performance of the server.
|
||||
#
|
||||
# Partial pathnames will be considered relative to the location of
|
||||
# the rippled.cfg file.
|
||||
# the xrpld.cfg file.
|
||||
#
|
||||
# [node_db] Settings for the Node Database (required)
|
||||
#
|
||||
@@ -1069,7 +1069,7 @@
|
||||
# The server creates and maintains 4 to 5 bookkeeping SQLite databases in
|
||||
# the 'database_path' location. If you omit this configuration setting,
|
||||
# the server creates a directory called "db" located in the same place as
|
||||
# your rippled.cfg file.
|
||||
# your xrpld.cfg file.
|
||||
# Partial pathnames are relative to the location of the rippled executable.
|
||||
#
|
||||
# [sqlite] Tuning settings for the SQLite databases (optional)
|
||||
@@ -1533,7 +1533,7 @@ advisory_delete=0
|
||||
|
||||
# File containing trusted validator keys or validator list publishers.
|
||||
# Unless an absolute path is specified, it will be considered relative to the
|
||||
# folder in which the rippled.cfg file is located.
|
||||
# folder in which the xrpld.cfg file is located.
|
||||
[validators_file]
|
||||
validators.txt
|
||||
|
||||
@@ -61,7 +61,7 @@ if (is_root_project AND TARGET xrpld)
|
||||
message (\"-- Skipping : \$ENV{DESTDIR}\${CMAKE_INSTALL_PREFIX}/\${DEST}/\${NEWNAME}\")
|
||||
endif ()
|
||||
endmacro()
|
||||
copy_if_not_exists(\"${CMAKE_CURRENT_SOURCE_DIR}/cfg/rippled-example.cfg\" etc rippled.cfg)
|
||||
copy_if_not_exists(\"${CMAKE_CURRENT_SOURCE_DIR}/cfg/xrpld-example.cfg\" etc xrpld.cfg)
|
||||
copy_if_not_exists(\"${CMAKE_CURRENT_SOURCE_DIR}/cfg/validators-example.txt\" etc validators.txt)
|
||||
")
|
||||
install(CODE "
|
||||
|
||||
@@ -130,7 +130,7 @@ newer versions of RocksDB (TBD).
|
||||
## Discussion
|
||||
|
||||
RocksDBQuickFactory is intended to provide a testbed for comparing potential
|
||||
rocksdb performance with the existing recommended configuration in rippled.cfg.
|
||||
rocksdb performance with the existing recommended configuration in xrpld.cfg.
|
||||
Through various executions and profiling some conclusions are presented below.
|
||||
|
||||
- If the write ahead log is enabled, insert speed soon clogs up under load. The
|
||||
|
||||
@@ -18,8 +18,8 @@ void
|
||||
ManagerImp::missing_backend()
|
||||
{
|
||||
Throw<std::runtime_error>(
|
||||
"Your rippled.cfg is missing a [node_db] entry, "
|
||||
"please see the rippled-example.cfg file!");
|
||||
"Your xrpld.cfg is missing a [node_db] entry, "
|
||||
"please see the xrpld-example.cfg file!");
|
||||
}
|
||||
|
||||
// We shouldn't rely on global variables for lifetime management because their
|
||||
|
||||
@@ -123,13 +123,14 @@ public:
|
||||
beast::unit_test::suite& test,
|
||||
path subDir,
|
||||
path const& dbPath,
|
||||
path const& configFile,
|
||||
path const& validatorsFile,
|
||||
bool useCounter = true,
|
||||
std::string confContents = "")
|
||||
: FileDirGuard(
|
||||
test,
|
||||
std::move(subDir),
|
||||
path(Config::configFileName),
|
||||
configFile,
|
||||
confContents.empty()
|
||||
? configContents(dbPath.string(), validatorsFile.string())
|
||||
: confContents,
|
||||
@@ -323,38 +324,47 @@ port_wss_admin
|
||||
BEAST_EXPECT(c.legacy("database_path") == "");
|
||||
}
|
||||
}
|
||||
char const* configFiles[] = {
|
||||
Config::configFileName, Config::configLegacyName};
|
||||
for (auto const& configFile : configFiles)
|
||||
{
|
||||
// read from file absolute path
|
||||
auto const cwd = current_path();
|
||||
xrpl::detail::DirGuard const g0(*this, "test_db");
|
||||
path const dataDirRel("test_data_dir");
|
||||
path const dataDirAbs(cwd / g0.subdir() / dataDirRel);
|
||||
detail::RippledCfgGuard const g(
|
||||
*this, g0.subdir(), dataDirAbs, "", false);
|
||||
auto const& c(g.config());
|
||||
BEAST_EXPECT(g.dataDirExists());
|
||||
BEAST_EXPECT(g.configFileExists());
|
||||
BEAST_EXPECT(c.legacy("database_path") == dataDirAbs.string());
|
||||
}
|
||||
{
|
||||
// read from file relative path
|
||||
std::string const dbPath("my_db");
|
||||
detail::RippledCfgGuard const g(*this, "test_db", dbPath, "");
|
||||
auto const& c(g.config());
|
||||
std::string const nativeDbPath = absolute(path(dbPath)).string();
|
||||
BEAST_EXPECT(g.dataDirExists());
|
||||
BEAST_EXPECT(g.configFileExists());
|
||||
BEAST_EXPECT(c.legacy("database_path") == nativeDbPath);
|
||||
}
|
||||
{
|
||||
// read from file no path
|
||||
detail::RippledCfgGuard const g(*this, "test_db", "", "");
|
||||
auto const& c(g.config());
|
||||
std::string const nativeDbPath =
|
||||
absolute(g.subdir() / path(Config::databaseDirName)).string();
|
||||
BEAST_EXPECT(g.dataDirExists());
|
||||
BEAST_EXPECT(g.configFileExists());
|
||||
BEAST_EXPECT(c.legacy("database_path") == nativeDbPath);
|
||||
{
|
||||
// read from file absolute path
|
||||
auto const cwd = current_path();
|
||||
xrpl::detail::DirGuard const g0(*this, "test_db");
|
||||
path const dataDirRel("test_data_dir");
|
||||
path const dataDirAbs(cwd / g0.subdir() / dataDirRel);
|
||||
detail::RippledCfgGuard const g(
|
||||
*this, g0.subdir(), dataDirAbs, configFile, "", false);
|
||||
auto const& c(g.config());
|
||||
BEAST_EXPECT(g.dataDirExists());
|
||||
BEAST_EXPECT(g.configFileExists());
|
||||
BEAST_EXPECT(c.legacy("database_path") == dataDirAbs.string());
|
||||
}
|
||||
{
|
||||
// read from file relative path
|
||||
std::string const dbPath("my_db");
|
||||
detail::RippledCfgGuard const g(
|
||||
*this, "test_db", dbPath, configFile, "");
|
||||
auto const& c(g.config());
|
||||
std::string const nativeDbPath =
|
||||
absolute(path(dbPath)).string();
|
||||
BEAST_EXPECT(g.dataDirExists());
|
||||
BEAST_EXPECT(g.configFileExists());
|
||||
BEAST_EXPECT(c.legacy("database_path") == nativeDbPath);
|
||||
}
|
||||
{
|
||||
// read from file no path
|
||||
detail::RippledCfgGuard const g(
|
||||
*this, "test_db", "", configFile, "");
|
||||
auto const& c(g.config());
|
||||
std::string const nativeDbPath =
|
||||
absolute(g.subdir() / path(Config::databaseDirName))
|
||||
.string();
|
||||
BEAST_EXPECT(g.dataDirExists());
|
||||
BEAST_EXPECT(g.configFileExists());
|
||||
BEAST_EXPECT(c.legacy("database_path") == nativeDbPath);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -737,7 +747,12 @@ trustthesevalidators.gov
|
||||
detail::ValidatorsTxtGuard const vtg(
|
||||
*this, "test_cfg", valFileName);
|
||||
detail::RippledCfgGuard const rcg(
|
||||
*this, vtg.subdir(), "", valFileName, false);
|
||||
*this,
|
||||
vtg.subdir(),
|
||||
"",
|
||||
Config::configFileName,
|
||||
valFileName,
|
||||
false);
|
||||
BEAST_EXPECT(vtg.validatorsFileExists());
|
||||
BEAST_EXPECT(rcg.configFileExists());
|
||||
auto const& c(rcg.config());
|
||||
@@ -759,7 +774,12 @@ trustthesevalidators.gov
|
||||
*this, "test_cfg", "validators.txt");
|
||||
auto const valFilePath = ".." / vtg.subdir() / "validators.txt";
|
||||
detail::RippledCfgGuard const rcg(
|
||||
*this, vtg.subdir(), "", valFilePath, false);
|
||||
*this,
|
||||
vtg.subdir(),
|
||||
"",
|
||||
Config::configFileName,
|
||||
valFilePath,
|
||||
false);
|
||||
BEAST_EXPECT(vtg.validatorsFileExists());
|
||||
BEAST_EXPECT(rcg.configFileExists());
|
||||
auto const& c(rcg.config());
|
||||
@@ -779,7 +799,7 @@ trustthesevalidators.gov
|
||||
detail::ValidatorsTxtGuard const vtg(
|
||||
*this, "test_cfg", "validators.txt");
|
||||
detail::RippledCfgGuard const rcg(
|
||||
*this, vtg.subdir(), "", "", false);
|
||||
*this, vtg.subdir(), "", Config::configFileName, "", false);
|
||||
BEAST_EXPECT(vtg.validatorsFileExists());
|
||||
BEAST_EXPECT(rcg.configFileExists());
|
||||
auto const& c(rcg.config());
|
||||
@@ -804,7 +824,12 @@ trustthesevalidators.gov
|
||||
*this, vtg.subdir(), "validators.txt", false);
|
||||
BEAST_EXPECT(vtgDefault.validatorsFileExists());
|
||||
detail::RippledCfgGuard const rcg(
|
||||
*this, vtg.subdir(), "", vtg.validatorsFile(), false);
|
||||
*this,
|
||||
vtg.subdir(),
|
||||
"",
|
||||
Config::configFileName,
|
||||
vtg.validatorsFile(),
|
||||
false);
|
||||
BEAST_EXPECT(rcg.configFileExists());
|
||||
auto const& c(rcg.config());
|
||||
BEAST_EXPECT(c.legacy("validators_file") == vtg.validatorsFile());
|
||||
@@ -861,7 +886,7 @@ trustthesevalidators.gov
|
||||
}
|
||||
{
|
||||
// load should throw if [validator_list_threshold] is present both
|
||||
// in rippled cfg and validators file
|
||||
// in xrpld.cfg and validators file
|
||||
boost::format cc(R"rippleConfig(
|
||||
[validators_file]
|
||||
%1%
|
||||
@@ -890,7 +915,7 @@ trustthesevalidators.gov
|
||||
}
|
||||
{
|
||||
// load should throw if [validators], [validator_keys] and
|
||||
// [validator_list_keys] are missing from rippled cfg and
|
||||
// [validator_list_keys] are missing from xrpld.cfg and
|
||||
// validators file
|
||||
Config c;
|
||||
boost::format cc("[validators_file]\n%1%\n");
|
||||
@@ -921,7 +946,11 @@ trustthesevalidators.gov
|
||||
testSetup(bool explicitPath)
|
||||
{
|
||||
detail::RippledCfgGuard const cfg(
|
||||
*this, "testSetup", explicitPath ? "test_db" : "", "");
|
||||
*this,
|
||||
"testSetup",
|
||||
explicitPath ? "test_db" : "",
|
||||
Config::configFileName,
|
||||
"");
|
||||
/* RippledCfgGuard has a Config object that gets loaded on
|
||||
construction, but Config::setup is not reentrant, so we
|
||||
need a fresh config for every test case, so ignore it.
|
||||
@@ -1039,7 +1068,8 @@ trustthesevalidators.gov
|
||||
void
|
||||
testPort()
|
||||
{
|
||||
detail::RippledCfgGuard const cfg(*this, "testPort", "", "");
|
||||
detail::RippledCfgGuard const cfg(
|
||||
*this, "testPort", "", Config::configFileName, "");
|
||||
auto const& conf = cfg.config();
|
||||
if (!BEAST_EXPECT(conf.exists("port_rpc")))
|
||||
return;
|
||||
@@ -1066,7 +1096,13 @@ trustthesevalidators.gov
|
||||
try
|
||||
{
|
||||
detail::RippledCfgGuard const cfg(
|
||||
*this, "testPort", "", "", true, contents);
|
||||
*this,
|
||||
"testPort",
|
||||
"",
|
||||
Config::configFileName,
|
||||
"",
|
||||
true,
|
||||
contents);
|
||||
BEAST_EXPECT(false);
|
||||
}
|
||||
catch (std::exception const& ex)
|
||||
|
||||
@@ -87,7 +87,7 @@ private:
|
||||
/// If the node is out of sync during an online_delete healthWait()
|
||||
/// call, sleep the thread for this time, and continue checking until
|
||||
/// recovery.
|
||||
/// See also: "recovery_wait_seconds" in rippled-example.cfg
|
||||
/// See also: "recovery_wait_seconds" in xrpld-example.cfg
|
||||
std::chrono::seconds recoveryWaitTime_{5};
|
||||
|
||||
// these do not exist upon SHAMapStore creation, but do exist
|
||||
|
||||
@@ -68,6 +68,7 @@ class Config : public BasicConfig
|
||||
public:
|
||||
// Settings related to the configuration file location and directories
|
||||
static char const* const configFileName;
|
||||
static char const* const configLegacyName;
|
||||
static char const* const databaseDirName;
|
||||
static char const* const validatorsFileName;
|
||||
|
||||
|
||||
@@ -221,11 +221,12 @@ getSingleSection(
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
//
|
||||
// Config (DEPRECATED)
|
||||
// Config
|
||||
//
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
char const* const Config::configFileName = "rippled.cfg";
|
||||
char const* const Config::configFileName = "xrpld.cfg";
|
||||
char const* const Config::configLegacyName = "rippled.cfg";
|
||||
char const* const Config::databaseDirName = "db";
|
||||
char const* const Config::validatorsFileName = "validators.txt";
|
||||
|
||||
@@ -295,76 +296,79 @@ Config::setup(
|
||||
bool bSilent,
|
||||
bool bStandalone)
|
||||
{
|
||||
boost::filesystem::path dataDir;
|
||||
std::string strDbPath, strConfFile;
|
||||
setupControl(bQuiet, bSilent, bStandalone);
|
||||
|
||||
// Determine the config and data directories.
|
||||
// If the config file is found in the current working
|
||||
// directory, use the current working directory as the
|
||||
// config directory and that with "db" as the data
|
||||
// directory.
|
||||
|
||||
setupControl(bQuiet, bSilent, bStandalone);
|
||||
|
||||
strDbPath = databaseDirName;
|
||||
|
||||
if (!strConf.empty())
|
||||
strConfFile = strConf;
|
||||
else
|
||||
strConfFile = configFileName;
|
||||
boost::filesystem::path dataDir;
|
||||
|
||||
if (!strConf.empty())
|
||||
{
|
||||
// --conf=<path> : everything is relative that file.
|
||||
CONFIG_FILE = strConfFile;
|
||||
CONFIG_FILE = strConf;
|
||||
CONFIG_DIR = boost::filesystem::absolute(CONFIG_FILE);
|
||||
CONFIG_DIR.remove_filename();
|
||||
dataDir = CONFIG_DIR / strDbPath;
|
||||
dataDir = CONFIG_DIR / databaseDirName;
|
||||
}
|
||||
else
|
||||
{
|
||||
CONFIG_DIR = boost::filesystem::current_path();
|
||||
CONFIG_FILE = CONFIG_DIR / strConfFile;
|
||||
dataDir = CONFIG_DIR / strDbPath;
|
||||
|
||||
// Construct XDG config and data home.
|
||||
// http://standards.freedesktop.org/basedir-spec/basedir-spec-latest.html
|
||||
auto const strHome = getEnvVar("HOME");
|
||||
auto strXdgConfigHome = getEnvVar("XDG_CONFIG_HOME");
|
||||
auto strXdgDataHome = getEnvVar("XDG_DATA_HOME");
|
||||
|
||||
if (boost::filesystem::exists(CONFIG_FILE)
|
||||
// Can we figure out XDG dirs?
|
||||
|| (strHome.empty() &&
|
||||
(strXdgConfigHome.empty() || strXdgDataHome.empty())))
|
||||
{
|
||||
// Current working directory is fine, put dbs in a subdir.
|
||||
}
|
||||
else
|
||||
do
|
||||
{
|
||||
// Construct XDG config and data home.
|
||||
// http://standards.freedesktop.org/basedir-spec/basedir-spec-latest.html.
|
||||
auto const strHome = getEnvVar("HOME");
|
||||
auto strXdgConfigHome = getEnvVar("XDG_CONFIG_HOME");
|
||||
auto strXdgDataHome = getEnvVar("XDG_DATA_HOME");
|
||||
|
||||
// Check if either of the config files exist in the current working
|
||||
// directory, in which case the databases will be stored in a
|
||||
// subdirectory.
|
||||
CONFIG_DIR = boost::filesystem::current_path();
|
||||
dataDir = CONFIG_DIR / databaseDirName;
|
||||
CONFIG_FILE = CONFIG_DIR / configFileName;
|
||||
if (boost::filesystem::exists(CONFIG_FILE))
|
||||
break;
|
||||
CONFIG_FILE = CONFIG_DIR / configLegacyName;
|
||||
if (boost::filesystem::exists(CONFIG_FILE))
|
||||
break;
|
||||
|
||||
// Check if the XDG config and/or data directories are set, in which
|
||||
// case we will use them, unless $HOME is not set.
|
||||
if (strHome.empty() &&
|
||||
(strXdgConfigHome.empty() || strXdgDataHome.empty()))
|
||||
break;
|
||||
if (strXdgConfigHome.empty())
|
||||
{
|
||||
// $XDG_CONFIG_HOME was not set, use default based on $HOME.
|
||||
strXdgConfigHome = strHome + "/.config";
|
||||
}
|
||||
|
||||
if (strXdgDataHome.empty())
|
||||
{
|
||||
// $XDG_DATA_HOME was not set, use default based on $HOME.
|
||||
strXdgDataHome = strHome + "/.local/share";
|
||||
}
|
||||
|
||||
CONFIG_DIR = strXdgConfigHome + "/" + systemName();
|
||||
CONFIG_FILE = CONFIG_DIR / strConfFile;
|
||||
// Check if either of the config files exist in the XDG config dir.
|
||||
dataDir = strXdgDataHome + "/" + systemName();
|
||||
CONFIG_DIR = strXdgConfigHome + "/" + systemName();
|
||||
CONFIG_FILE = CONFIG_DIR / configFileName;
|
||||
if (boost::filesystem::exists(CONFIG_FILE))
|
||||
break;
|
||||
CONFIG_FILE = CONFIG_DIR / configLegacyName;
|
||||
if (boost::filesystem::exists(CONFIG_FILE))
|
||||
break;
|
||||
|
||||
if (!boost::filesystem::exists(CONFIG_FILE))
|
||||
{
|
||||
CONFIG_DIR = "/etc/opt/" + systemName();
|
||||
CONFIG_FILE = CONFIG_DIR / strConfFile;
|
||||
dataDir = "/var/opt/" + systemName();
|
||||
}
|
||||
}
|
||||
// As a last resort, check the system config directory.
|
||||
dataDir = "/var/opt/" + systemName();
|
||||
CONFIG_DIR = "/etc/opt/" + systemName();
|
||||
CONFIG_FILE = CONFIG_DIR / configFileName;
|
||||
if (boost::filesystem::exists(CONFIG_FILE))
|
||||
break;
|
||||
CONFIG_FILE = CONFIG_DIR / configLegacyName;
|
||||
} while (false);
|
||||
}
|
||||
|
||||
// Update default values
|
||||
@@ -374,11 +378,9 @@ Config::setup(
|
||||
std::string const dbPath(legacy("database_path"));
|
||||
if (!dbPath.empty())
|
||||
dataDir = boost::filesystem::path(dbPath);
|
||||
else if (RUN_STANDALONE)
|
||||
dataDir.clear();
|
||||
}
|
||||
|
||||
if (!dataDir.empty())
|
||||
if (!RUN_STANDALONE)
|
||||
{
|
||||
boost::system::error_code ec;
|
||||
boost::filesystem::create_directories(dataDir, ec);
|
||||
|
||||
@@ -373,7 +373,7 @@ command. The key is in the `pubkey_node` value, and is a text string
|
||||
beginning with the letter `n`. The key is maintained across runs in a
|
||||
database.
|
||||
|
||||
Cluster members are configured in the `rippled.cfg` file under
|
||||
Cluster members are configured in the `xrpld.cfg` file under
|
||||
`[cluster_nodes]`. Each member should be configured on a line beginning
|
||||
with the node public key, followed optionally by a space and a friendly
|
||||
name.
|
||||
|
||||
@@ -514,7 +514,7 @@ OverlayImpl::start()
|
||||
m_peerFinder->addFallbackStrings(base + name, ips);
|
||||
});
|
||||
|
||||
// Add the ips_fixed from the rippled.cfg file
|
||||
// Add the ips_fixed from the xrpld.cfg file
|
||||
if (!app_.config().standalone() && !app_.config().IPS_FIXED.empty())
|
||||
{
|
||||
m_resolver.resolve(
|
||||
|
||||
@@ -41,7 +41,7 @@ public:
|
||||
using microseconds = std::chrono::microseconds;
|
||||
|
||||
/**
|
||||
* Configuration from [perf] section of rippled.cfg.
|
||||
* Configuration from [perf] section of xrpld.cfg.
|
||||
*/
|
||||
struct Setup
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user