xrpld
Loading...
Searching...
No Matches
xrpl::Config Class Reference

#include <Config.h>

Inheritance diagram for xrpl::Config:
Collaboration diagram for xrpl::Config:

Public Member Functions

boost::filesystem::path getDebugLogFile () const
 Returns the full path and filename of the debug log file.
 Config ()
void setup (std::string const &strConf, bool bQuiet, bool bSilent, bool bStandalone)
void setupControl (bool bQuiet, bool bSilent, bool bStandalone)
void loadFromString (std::string const &fileContents)
 Load the config from the contents of the string.
bool quiet () const
bool silent () const
bool standalone () const
bool useTxTables () const
bool canSign () const
int getValueFor (SizedItem item, std::optional< std::size_t > node=std::nullopt) const
 Retrieve the default value for the item at the specified node size.
beast::Journal journal () const
bool exists (std::string const &name) const
 Returns true if a section with the given name exists.
void overwrite (std::string const &section, std::string const &key, std::string const &value)
 Overwrite a key/value pair with a command line argument If the section does not exist it is created.
void deprecatedClearSection (std::string const &section)
 Remove all the key/value pairs from the section.
void legacy (std::string const &section, std::string value)
 Set a value that is not a key/value pair.
std::string legacy (std::string const &sectionName) const
 Get the legacy value of a section.
bool hadTrailingComments () const
Sectionsection (std::string const &name)
 Returns the section with the given name.
Section const & section (std::string const &name) const
Section const & operator[] (std::string const &name) const
Sectionoperator[] (std::string const &name)

Public Attributes

boost::filesystem::path configDir
bool doImport = false
bool elbSupport = false
std::vector< std::stringips
std::vector< std::stringipsFixed
StartUpType startUp = StartUpType::Normal
bool startValid = false
std::string startLedger
std::optional< uint256trapTxHash
uint32_t networkId = 0
std::size_t networkQuorum = 1
int relayUntrustedValidations = 1
int relayUntrustedProposals = 0
bool peerPrivate = false
std::size_t peersMax = 0
std::size_t peersOutMax = 0
std::size_t peersInMax = 0
int pathSearchOld = 2
int pathSearch = 2
int pathSearchFast = 2
int pathSearchMax = 3
std::optional< std::size_tvalidationQuorum
FeeSetup fees
std::uint32_t ledgerHistory = 256
std::uint32_t fetchDepth = 1000000000
std::size_t nodeSize = 0
bool sslVerify = true
std::string sslVerifyFile
std::string sslVerifyDir
bool compression = false
bool ledgerReplay = false
int maxTransactions = 250
std::chrono::seconds amendmentMajorityTime = kDefaultAmendmentMajorityTime
int workers = 0
int ioWorkers = 0
int prefetchWorkers = 0
bool forceMultiThread = false
std::optional< int > sweepInterval
bool vpReduceRelayBaseSquelchEnable = false
std::size_t vpReduceRelaySquelchMaxSelectedPeers = 5
bool txReduceRelayEnable = false
bool txReduceRelayMetrics = false
std::size_t txReduceRelayMinPeers = 20
std::size_t txRelayPercentage = 25
std::optional< beast::IP::EndpointrpcIp
std::unordered_set< uint256, beast::Uhash<> > features
std::string serverDomain
std::chrono::seconds maxUnknownTime {600}
std::chrono::seconds maxDivergedTime {300}
bool betaRpcApi = false
bool fastLoad = false
std::optional< std::pair< std::uint32_t, std::uint32_t > > forcedLedgerRangePresent
std::optional< std::size_tvalidatorListThreshold

Static Public Attributes

static char const *const kConfigFileName = "xrpld.cfg"
static char const *const kConfigLegacyName = "rippled.cfg"
static char const *const kDatabaseDirName = "db"
static char const *const kValidatorsFileName = "validators.txt"
static constexpr int kMaxJobQueueTx = 1000
static constexpr int kMinJobQueueTx = 100

Protected Member Functions

void build (IniFileSections const &ifs)

Private Member Functions

void load ()

Private Attributes

boost::filesystem::path configFile_
boost::filesystem::path debugLogfile_
beast::Journal const j_
bool quiet_ = false
bool silent_ = false
bool runStandalone_ = false
 Operate in stand-alone mode.
bool useTxTables_ = true
bool signingEnabled_ = false
 Determines if the server will sign a tx, given an account's secret seed.
std::uint64_t const ramSize_
std::unordered_map< std::string, Sectionmap_

Detailed Description

Definition at line 75 of file Config.h.

Constructor & Destructor Documentation

◆ Config()

xrpl::Config::Config ( )

Definition at line 266 of file Config.cpp.

Member Function Documentation

◆ getDebugLogFile()

boost::filesystem::path xrpl::Config::getDebugLogFile ( ) const
nodiscard

Returns the full path and filename of the debug log file.

Definition at line 1156 of file Config.cpp.

◆ load()

void xrpl::Config::load ( )
private

Definition at line 450 of file Config.cpp.

◆ setup()

void xrpl::Config::setup ( std::string const & strConf,
bool bQuiet,
bool bSilent,
bool bStandalone )

Definition at line 307 of file Config.cpp.

◆ setupControl()

void xrpl::Config::setupControl ( bool bQuiet,
bool bSilent,
bool bStandalone )

Definition at line 272 of file Config.cpp.

◆ loadFromString()

void xrpl::Config::loadFromString ( std::string const & fileContents)

Load the config from the contents of the string.

Parameters
fileContentsString representing the config contents.

Definition at line 473 of file Config.cpp.

◆ quiet()

bool xrpl::Config::quiet ( ) const
nodiscard

Definition at line 306 of file Config.h.

◆ silent()

bool xrpl::Config::silent ( ) const
nodiscard

Definition at line 311 of file Config.h.

◆ standalone()

bool xrpl::Config::standalone ( ) const
nodiscard

Definition at line 316 of file Config.h.

◆ useTxTables()

bool xrpl::Config::useTxTables ( ) const
nodiscard

Definition at line 322 of file Config.h.

◆ canSign()

bool xrpl::Config::canSign ( ) const
nodiscard

Definition at line 328 of file Config.h.

◆ getValueFor()

int xrpl::Config::getValueFor ( SizedItem item,
std::optional< std::size_t > node = std::nullopt ) const
nodiscard

Retrieve the default value for the item at the specified node size.

Parameters
itemThe item for which the default value is needed
nodeOptional value, used to adjust the result to match the size of a node (0: tiny, ..., 4: huge). If unseated, uses the configured size (NODE_SIZE).
Exceptions
Thismethod can throw std::out_of_range if you ask for values that it does not recognize or request a non-default node-size.
Returns
The value for the requested item.
Note
The defaults are selected so as to be reasonable, but the node size is an imprecise metric that combines multiple aspects of the underlying system; this means that we can't provide optimal defaults in the code for every case.

Definition at line 1190 of file Config.cpp.

◆ journal()

beast::Journal xrpl::Config::journal ( ) const
nodiscard

Definition at line 354 of file Config.h.

◆ exists()

bool xrpl::BasicConfig::exists ( std::string const & name) const
nodiscardinherited

Returns true if a section with the given name exists.

Definition at line 115 of file BasicConfig.cpp.

◆ section() [1/2]

Section & xrpl::BasicConfig::section ( std::string const & name)
inherited

Returns the section with the given name.

If the section does not exist, an empty section is returned.

Definition at line 121 of file BasicConfig.cpp.

◆ section() [2/2]

Section const & xrpl::BasicConfig::section ( std::string const & name) const
nodiscardinherited

Definition at line 127 of file BasicConfig.cpp.

◆ operator[]() [1/2]

Section const & xrpl::BasicConfig::operator[] ( std::string const & name) const
inherited

Definition at line 223 of file BasicConfig.h.

◆ operator[]() [2/2]

Section & xrpl::BasicConfig::operator[] ( std::string const & name)
inherited

Definition at line 229 of file BasicConfig.h.

◆ overwrite()

void xrpl::BasicConfig::overwrite ( std::string const & section,
std::string const & key,
std::string const & value )
inherited

Overwrite a key/value pair with a command line argument If the section does not exist it is created.

The previous value, if any, is overwritten.

Definition at line 137 of file BasicConfig.cpp.

◆ deprecatedClearSection()

void xrpl::BasicConfig::deprecatedClearSection ( std::string const & section)
inherited

Remove all the key/value pairs from the section.

Definition at line 145 of file BasicConfig.cpp.

◆ legacy() [1/2]

void xrpl::BasicConfig::legacy ( std::string const & section,
std::string value )
inherited

Set a value that is not a key/value pair.

The value is stored as the section's first value and may be retrieved through section::legacy.

Parameters
sectionName of the section to modify.
valueContents of the legacy value.

Definition at line 153 of file BasicConfig.cpp.

◆ legacy() [2/2]

std::string xrpl::BasicConfig::legacy ( std::string const & sectionName) const
nodiscardinherited

Get the legacy value of a section.

A section with a single-line value may be retrieved as a legacy value.

Parameters
sectionNameRetrieve the contents of this section's legacy value.
Returns
Contents of the legacy value.

Definition at line 159 of file BasicConfig.cpp.

◆ hadTrailingComments()

bool xrpl::BasicConfig::hadTrailingComments ( ) const
nodiscardinherited

Definition at line 276 of file BasicConfig.h.

◆ build()

void xrpl::BasicConfig::build ( IniFileSections const & ifs)
protectedinherited

Definition at line 165 of file BasicConfig.cpp.

Member Data Documentation

◆ kConfigFileName

char const *const xrpl::Config::kConfigFileName = "xrpld.cfg"
static

Definition at line 79 of file Config.h.

◆ kConfigLegacyName

char const *const xrpl::Config::kConfigLegacyName = "rippled.cfg"
static

Definition at line 80 of file Config.h.

◆ kDatabaseDirName

char const *const xrpl::Config::kDatabaseDirName = "db"
static

Definition at line 81 of file Config.h.

◆ kValidatorsFileName

char const *const xrpl::Config::kValidatorsFileName = "validators.txt"
static

Definition at line 82 of file Config.h.

◆ configFile_

boost::filesystem::path xrpl::Config::configFile_
private

Definition at line 89 of file Config.h.

◆ configDir

boost::filesystem::path xrpl::Config::configDir

Definition at line 92 of file Config.h.

◆ debugLogfile_

boost::filesystem::path xrpl::Config::debugLogfile_
private

Definition at line 95 of file Config.h.

◆ j_

beast::Journal const xrpl::Config::j_
private

Definition at line 99 of file Config.h.

◆ quiet_

bool xrpl::Config::quiet_ = false
private

Definition at line 101 of file Config.h.

◆ silent_

bool xrpl::Config::silent_ = false
private

Definition at line 102 of file Config.h.

◆ runStandalone_

bool xrpl::Config::runStandalone_ = false
private

Operate in stand-alone mode.

In stand alone mode:

  • Peer connections are not attempted or accepted
  • The ledger is not advanced automatically.
  • If no ledger is loaded, the default ledger with the root account is created.

Definition at line 112 of file Config.h.

◆ useTxTables_

bool xrpl::Config::useTxTables_ = true
private

Definition at line 114 of file Config.h.

◆ signingEnabled_

bool xrpl::Config::signingEnabled_ = false
private

Determines if the server will sign a tx, given an account's secret seed.

In the past, this was allowed, but this functionality can have security implications. The new default is to not allow this functionality, but a config option is included to enable this.

Definition at line 122 of file Config.h.

◆ ramSize_

std::uint64_t const xrpl::Config::ramSize_
private

Definition at line 125 of file Config.h.

◆ doImport

bool xrpl::Config::doImport = false

Definition at line 128 of file Config.h.

◆ elbSupport

bool xrpl::Config::elbSupport = false

Definition at line 129 of file Config.h.

◆ ips

std::vector<std::string> xrpl::Config::ips

Definition at line 132 of file Config.h.

◆ ipsFixed

std::vector<std::string> xrpl::Config::ipsFixed

Definition at line 135 of file Config.h.

◆ startUp

StartUpType xrpl::Config::startUp = StartUpType::Normal

Definition at line 137 of file Config.h.

◆ startValid

bool xrpl::Config::startValid = false

Definition at line 139 of file Config.h.

◆ startLedger

std::string xrpl::Config::startLedger

Definition at line 141 of file Config.h.

◆ trapTxHash

std::optional<uint256> xrpl::Config::trapTxHash

Definition at line 143 of file Config.h.

◆ networkId

uint32_t xrpl::Config::networkId = 0

Definition at line 146 of file Config.h.

◆ networkQuorum

std::size_t xrpl::Config::networkQuorum = 1

Definition at line 150 of file Config.h.

◆ relayUntrustedValidations

int xrpl::Config::relayUntrustedValidations = 1

Definition at line 155 of file Config.h.

◆ relayUntrustedProposals

int xrpl::Config::relayUntrustedProposals = 0

Definition at line 156 of file Config.h.

◆ peerPrivate

bool xrpl::Config::peerPrivate = false

Definition at line 159 of file Config.h.

◆ peersMax

std::size_t xrpl::Config::peersMax = 0

Definition at line 165 of file Config.h.

◆ peersOutMax

std::size_t xrpl::Config::peersOutMax = 0

Definition at line 166 of file Config.h.

◆ peersInMax

std::size_t xrpl::Config::peersInMax = 0

Definition at line 167 of file Config.h.

◆ pathSearchOld

int xrpl::Config::pathSearchOld = 2

Definition at line 181 of file Config.h.

◆ pathSearch

int xrpl::Config::pathSearch = 2

Definition at line 182 of file Config.h.

◆ pathSearchFast

int xrpl::Config::pathSearchFast = 2

Definition at line 183 of file Config.h.

◆ pathSearchMax

int xrpl::Config::pathSearchMax = 3

Definition at line 184 of file Config.h.

◆ validationQuorum

std::optional<std::size_t> xrpl::Config::validationQuorum

Definition at line 187 of file Config.h.

◆ fees

FeeSetup xrpl::Config::fees

Definition at line 189 of file Config.h.

◆ ledgerHistory

std::uint32_t xrpl::Config::ledgerHistory = 256

Definition at line 192 of file Config.h.

◆ fetchDepth

std::uint32_t xrpl::Config::fetchDepth = 1000000000

Definition at line 193 of file Config.h.

◆ nodeSize

std::size_t xrpl::Config::nodeSize = 0

Definition at line 198 of file Config.h.

◆ sslVerify

bool xrpl::Config::sslVerify = true

Definition at line 200 of file Config.h.

◆ sslVerifyFile

std::string xrpl::Config::sslVerifyFile

Definition at line 201 of file Config.h.

◆ sslVerifyDir

std::string xrpl::Config::sslVerifyDir

Definition at line 202 of file Config.h.

◆ compression

bool xrpl::Config::compression = false

Definition at line 205 of file Config.h.

◆ ledgerReplay

bool xrpl::Config::ledgerReplay = false

Definition at line 208 of file Config.h.

◆ maxTransactions

int xrpl::Config::maxTransactions = 250

Definition at line 211 of file Config.h.

◆ kMaxJobQueueTx

int xrpl::Config::kMaxJobQueueTx = 1000
staticconstexpr

Definition at line 212 of file Config.h.

◆ kMinJobQueueTx

int xrpl::Config::kMinJobQueueTx = 100
staticconstexpr

Definition at line 213 of file Config.h.

◆ amendmentMajorityTime

std::chrono::seconds xrpl::Config::amendmentMajorityTime = kDefaultAmendmentMajorityTime

Definition at line 216 of file Config.h.

◆ workers

int xrpl::Config::workers = 0

Definition at line 219 of file Config.h.

◆ ioWorkers

int xrpl::Config::ioWorkers = 0

Definition at line 220 of file Config.h.

◆ prefetchWorkers

int xrpl::Config::prefetchWorkers = 0

Definition at line 221 of file Config.h.

◆ forceMultiThread

bool xrpl::Config::forceMultiThread = false

Definition at line 224 of file Config.h.

◆ sweepInterval

std::optional<int> xrpl::Config::sweepInterval

Definition at line 228 of file Config.h.

◆ vpReduceRelayBaseSquelchEnable

bool xrpl::Config::vpReduceRelayBaseSquelchEnable = false

Definition at line 233 of file Config.h.

◆ vpReduceRelaySquelchMaxSelectedPeers

std::size_t xrpl::Config::vpReduceRelaySquelchMaxSelectedPeers = 5

Definition at line 239 of file Config.h.

◆ txReduceRelayEnable

bool xrpl::Config::txReduceRelayEnable = false

Definition at line 243 of file Config.h.

◆ txReduceRelayMetrics

bool xrpl::Config::txReduceRelayMetrics = false

Definition at line 250 of file Config.h.

◆ txReduceRelayMinPeers

std::size_t xrpl::Config::txReduceRelayMinPeers = 20

Definition at line 253 of file Config.h.

◆ txRelayPercentage

std::size_t xrpl::Config::txRelayPercentage = 25

Definition at line 256 of file Config.h.

◆ rpcIp

std::optional<beast::IP::Endpoint> xrpl::Config::rpcIp

Definition at line 259 of file Config.h.

◆ features

std::unordered_set<uint256, beast::Uhash<> > xrpl::Config::features

Definition at line 261 of file Config.h.

◆ serverDomain

std::string xrpl::Config::serverDomain

Definition at line 263 of file Config.h.

◆ maxUnknownTime

std::chrono::seconds xrpl::Config::maxUnknownTime {600}

Definition at line 266 of file Config.h.

◆ maxDivergedTime

std::chrono::seconds xrpl::Config::maxDivergedTime {300}

Definition at line 269 of file Config.h.

◆ betaRpcApi

bool xrpl::Config::betaRpcApi = false

Definition at line 272 of file Config.h.

◆ fastLoad

bool xrpl::Config::fastLoad = false

Definition at line 275 of file Config.h.

◆ forcedLedgerRangePresent

std::optional<std::pair<std::uint32_t, std::uint32_t> > xrpl::Config::forcedLedgerRangePresent

Definition at line 282 of file Config.h.

◆ validatorListThreshold

std::optional<std::size_t> xrpl::Config::validatorListThreshold

Definition at line 284 of file Config.h.

◆ map_

std::unordered_map<std::string, Section> xrpl::BasicConfig::map_
privateinherited

Definition at line 205 of file BasicConfig.h.