refactor: Make the config name constants constexpr string views (#8332)

Co-authored-by: Bart <11445373+bthomee@users.noreply.github.com>
This commit is contained in:
Bart
2026-09-30 10:50:18 +00:00
committed by GitHub
parent 53246e5b15
commit b3bbf50d40
4 changed files with 7 additions and 11 deletions

View File

@@ -62,7 +62,7 @@ ${SED_COMMAND} -i 's@ripple/@xrpld/@g' src/test/core/Config_test.cpp
${SED_COMMAND} -i 's/Rippled/File/g' src/test/core/Config_test.cpp
# Restore the old config file name in the code that maintains support for now.
${SED_COMMAND} -i 's/kConfigLegacyName = "xrpld.cfg"/kConfigLegacyName = "rippled.cfg"/g' src/xrpld/core/detail/Config.cpp
${SED_COMMAND} -i 's/kConfigLegacyName = "xrpld.cfg"/kConfigLegacyName = "rippled.cfg"/g' src/xrpld/core/Config.h
# Restore an URL.
${SED_COMMAND} -i 's/connect-your-xrpld-to-the-xrp-test-net.html/connect-your-rippled-to-the-xrp-test-net.html/g' cfg/xrpld-example.cfg

View File

@@ -90,7 +90,7 @@ ${SED_COMMAND} -i 's/www.ripple.com/www.xrpl.org/g' src/test/protocol/Seed_test.
# Restore specific changes.
${SED_COMMAND} -i 's@b5efcc/src/xrpld@b5efcc/src/ripple@' include/xrpl/protocol/README.md
${SED_COMMAND} -i 's/dbPrefix_ = "xrpldb"/dbPrefix_ = "rippledb"/' src/xrpld/app/misc/SHAMapStoreImp.h # cspell: disable-line
${SED_COMMAND} -i 's/kConfigLegacyName = "xrpld.cfg"/kConfigLegacyName = "rippled.cfg"/' src/xrpld/core/detail/Config.cpp
${SED_COMMAND} -i 's/kConfigLegacyName = "xrpld.cfg"/kConfigLegacyName = "rippled.cfg"/' src/xrpld/core/Config.h
popd
echo "Renaming complete."

View File

@@ -17,6 +17,7 @@
#include <filesystem>
#include <optional>
#include <string>
#include <string_view>
#include <unordered_set>
#include <utility>
#include <vector>
@@ -88,10 +89,10 @@ class Config : public BasicConfig
{
public:
// Settings related to the configuration file location and directories
static char const* const kConfigFileName;
static char const* const kConfigLegacyName;
static char const* const kDatabaseDirName;
static char const* const kValidatorsFileName;
static constexpr std::string_view kConfigFileName = "xrpld.cfg";
static constexpr std::string_view kConfigLegacyName = "rippled.cfg";
static constexpr std::string_view kDatabaseDirName = "db";
static constexpr std::string_view kValidatorsFileName = "validators.txt";
/**
* Returns the full path and filename of the debug log file.

View File

@@ -246,11 +246,6 @@ getSingleSection(
//
//------------------------------------------------------------------------------
char const* const Config::kConfigFileName = "xrpld.cfg";
char const* const Config::kConfigLegacyName = "rippled.cfg";
char const* const Config::kDatabaseDirName = "db";
char const* const Config::kValidatorsFileName = "validators.txt";
[[nodiscard]] static std::string
getEnvVar(char const* name)
{