rippled
Config.cpp
1 //------------------------------------------------------------------------------
2 /*
3  This file is part of rippled: https://github.com/ripple/rippled
4  Copyright (c) 2012, 2013 Ripple Labs Inc.
5 
6  Permission to use, copy, modify, and/or distribute this software for any
7  purpose with or without fee is hereby granted, provided that the above
8  copyright notice and this permission notice appear in all copies.
9 
10  THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
11  WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
12  MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
13  ANY SPECIAL , DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
14  WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
15  ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
16  OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
17 */
18 //==============================================================================
19 
20 #include <ripple/core/Config.h>
21 #include <ripple/core/ConfigSections.h>
22 #include <ripple/basics/contract.h>
23 #include <ripple/basics/FileUtilities.h>
24 #include <ripple/basics/Log.h>
25 #include <ripple/json/json_reader.h>
26 #include <ripple/protocol/Feature.h>
27 #include <ripple/protocol/SystemParameters.h>
28 #include <ripple/net/HTTPClient.h>
29 #include <ripple/beast/core/LexicalCast.h>
30 #include <boost/beast/core/string.hpp>
31 #include <boost/algorithm/string.hpp>
32 #include <boost/format.hpp>
33 #include <boost/regex.hpp>
34 #include <boost/system/error_code.hpp>
35 #include <algorithm>
36 #include <fstream>
37 #include <iostream>
38 #include <iterator>
39 
40 namespace ripple {
41 
42 inline constexpr
45 {{
46  // FIXME: We should document each of these items, explaining exactly what
47  // they control and whether there exists an explicit config option
48  // that can be used to override the default.
50  {{ 10, 30, 60, 90, 120 }} },
52  {{ 128000, 256000, 512000, 768000, 2048000 }} },
54  {{ 30, 60, 90, 120, 900 }} },
56  {{ 32, 128, 256, 384, 768 }} },
58  {{ 30, 90, 180, 240, 900 }} },
60  {{ 2, 3, 4, 5, 8 }} },
62  {{ 16384, 32768, 131072, 262144, 524288 }} },
64  {{ 60, 90, 120, 900, 1800 }} },
66  {{ 4, 12, 24, 64, 128 }} },
68  {{ 4, 12, 24, 64, 128 }} },
70  {{ 4, 8, 16, 32, 128 }} },
71 }};
72 
73 // Ensure that the order of entries in the table corresponds to the
74 // order of entries in the enum:
75 static_assert([]() constexpr -> bool
76 {
78 
79  for (auto const& i : sizedItems)
80  {
81  if (static_cast<std::underlying_type_t<SizedItem>>(i.first) != idx)
82  return false;
83 
84  ++idx;
85  }
86 
87  return true;
88 }(), "Mismatch between sized item enum & array indices");
89 
90 //
91 // TODO: Check permissions on config file before using it.
92 //
93 
94 #define SECTION_DEFAULT_NAME ""
95 
97 parseIniFile (std::string const& strInput, const bool bTrim)
98 {
99  std::string strData (strInput);
101  IniFileSections secResult;
102 
103  // Convert DOS format to unix.
104  boost::algorithm::replace_all (strData, "\r\n", "\n");
105 
106  // Convert MacOS format to unix.
107  boost::algorithm::replace_all (strData, "\r", "\n");
108 
109  boost::algorithm::split (vLines, strData,
110  boost::algorithm::is_any_of ("\n"));
111 
112  // Set the default Section name.
113  std::string strSection = SECTION_DEFAULT_NAME;
114 
115  // Initialize the default Section.
116  secResult[strSection] = IniFileSections::mapped_type ();
117 
118  // Parse each line.
119  for (auto& strValue : vLines)
120  {
121  if (bTrim)
122  boost::algorithm::trim (strValue);
123 
124  if (strValue.empty () || strValue[0] == '#')
125  {
126  // Blank line or comment, do nothing.
127  }
128  else if (strValue[0] == '[' && strValue[strValue.length () - 1] == ']')
129  {
130  // New Section.
131  strSection = strValue.substr (1, strValue.length () - 2);
132  secResult.emplace(strSection, IniFileSections::mapped_type{});
133  }
134  else
135  {
136  // Another line for Section.
137  if (!strValue.empty ())
138  secResult[strSection].push_back (strValue);
139  }
140  }
141 
142  return secResult;
143 }
144 
145 IniFileSections::mapped_type*
146 getIniFileSection (IniFileSections& secSource, std::string const& strSection)
147 {
148  IniFileSections::iterator it;
149  IniFileSections::mapped_type* smtResult;
150  it = secSource.find (strSection);
151  if (it == secSource.end ())
152  smtResult = nullptr;
153  else
154  smtResult = & (it->second);
155  return smtResult;
156 }
157 
159  std::string const& strSection, std::string& strValue, beast::Journal j)
160 {
161  IniFileSections::mapped_type* pmtEntries =
162  getIniFileSection (secSource, strSection);
163  bool bSingle = pmtEntries && 1 == pmtEntries->size ();
164 
165  if (bSingle)
166  {
167  strValue = (*pmtEntries)[0];
168  }
169  else if (pmtEntries)
170  {
171  JLOG (j.warn()) << boost::str (
172  boost::format ("Section [%s]: requires 1 line not %d lines.") %
173  strSection % pmtEntries->size ());
174  }
175 
176  return bSingle;
177 }
178 
179 //------------------------------------------------------------------------------
180 //
181 // Config (DEPRECATED)
182 //
183 //------------------------------------------------------------------------------
184 
185 char const* const Config::configFileName = "rippled.cfg";
186 char const* const Config::databaseDirName = "db";
187 char const* const Config::validatorsFileName = "validators.txt";
188 
189 static
191 getEnvVar (char const* name)
192 {
193  std::string value;
194 
195  auto const v = getenv (name);
196 
197  if (v != nullptr)
198  value = v;
199 
200  return value;
201 }
202 
204 
205 void Config::setupControl(bool bQuiet,
206  bool bSilent, bool bStandalone)
207 {
208  QUIET = bQuiet || bSilent;
209  SILENT = bSilent;
210  RUN_STANDALONE = bStandalone;
211 }
212 
213 void Config::setup (std::string const& strConf, bool bQuiet,
214  bool bSilent, bool bStandalone)
215 {
216  boost::filesystem::path dataDir;
217  std::string strDbPath, strConfFile;
218 
219  // Determine the config and data directories.
220  // If the config file is found in the current working
221  // directory, use the current working directory as the
222  // config directory and that with "db" as the data
223  // directory.
224 
225  setupControl(bQuiet, bSilent, bStandalone);
226 
227  strDbPath = databaseDirName;
228 
229  if (!strConf.empty())
230  strConfFile = strConf;
231  else
232  strConfFile = configFileName;
233 
234  if (!strConf.empty ())
235  {
236  // --conf=<path> : everything is relative that file.
237  CONFIG_FILE = strConfFile;
238  CONFIG_DIR = boost::filesystem::absolute (CONFIG_FILE);
239  CONFIG_DIR.remove_filename ();
240  dataDir = CONFIG_DIR / strDbPath;
241  }
242  else
243  {
244  CONFIG_DIR = boost::filesystem::current_path ();
245  CONFIG_FILE = CONFIG_DIR / strConfFile;
246  dataDir = CONFIG_DIR / strDbPath;
247 
248  // Construct XDG config and data home.
249  // http://standards.freedesktop.org/basedir-spec/basedir-spec-latest.html
250  std::string strHome = getEnvVar ("HOME");
251  std::string strXdgConfigHome = getEnvVar ("XDG_CONFIG_HOME");
252  std::string strXdgDataHome = getEnvVar ("XDG_DATA_HOME");
253 
254  if (boost::filesystem::exists (CONFIG_FILE)
255  // Can we figure out XDG dirs?
256  || (strHome.empty () && (strXdgConfigHome.empty () || strXdgDataHome.empty ())))
257  {
258  // Current working directory is fine, put dbs in a subdir.
259  }
260  else
261  {
262  if (strXdgConfigHome.empty ())
263  {
264  // $XDG_CONFIG_HOME was not set, use default based on $HOME.
265  strXdgConfigHome = strHome + "/.config";
266  }
267 
268  if (strXdgDataHome.empty ())
269  {
270  // $XDG_DATA_HOME was not set, use default based on $HOME.
271  strXdgDataHome = strHome + "/.local/share";
272  }
273 
274  CONFIG_DIR = strXdgConfigHome + "/" + systemName ();
275  CONFIG_FILE = CONFIG_DIR / strConfFile;
276  dataDir = strXdgDataHome + "/" + systemName ();
277 
278  if (!boost::filesystem::exists (CONFIG_FILE))
279  {
280  CONFIG_DIR = "/etc/opt/" + systemName ();
281  CONFIG_FILE = CONFIG_DIR / strConfFile;
282  dataDir = "/var/opt/" + systemName();
283  }
284  }
285  }
286 
287  // Update default values
288  load ();
289  {
290  // load() may have set a new value for the dataDir
291  std::string const dbPath (legacy ("database_path"));
292  if (!dbPath.empty ())
293  dataDir = boost::filesystem::path (dbPath);
294  else if (RUN_STANDALONE)
295  dataDir.clear();
296  }
297 
298  if (!dataDir.empty())
299  {
300  boost::system::error_code ec;
301  boost::filesystem::create_directories(dataDir, ec);
302 
303  if (ec)
304  Throw<std::runtime_error>(
305  boost::str(boost::format("Can not create %s") % dataDir));
306 
307  legacy("database_path", boost::filesystem::absolute(dataDir).string());
308  }
309 
311 
312  if (RUN_STANDALONE)
313  LEDGER_HISTORY = 0;
314 }
315 
317 {
318  // NOTE: this writes to cerr because we want cout to be reserved
319  // for the writing of the json response (so that stdout can be part of a
320  // pipeline, for instance)
321  if (!QUIET)
322  std::cerr << "Loading: " << CONFIG_FILE << "\n";
323 
324  boost::system::error_code ec;
325  auto const fileContents = getFileContents(ec, CONFIG_FILE);
326 
327  if (ec)
328  {
329  std::cerr << "Failed to read '" << CONFIG_FILE << "'." <<
330  ec.value() << ": " << ec.message() << std::endl;
331  return;
332  }
333 
334  loadFromString (fileContents);
335 }
336 
337 void Config::loadFromString (std::string const& fileContents)
338 {
339  IniFileSections secConfig = parseIniFile (fileContents, true);
340 
341  build (secConfig);
342 
343  if (auto s = getIniFileSection (secConfig, SECTION_IPS))
344  IPS = *s;
345 
346  if (auto s = getIniFileSection (secConfig, SECTION_IPS_FIXED))
347  IPS_FIXED = *s;
348 
349  if (auto s = getIniFileSection (secConfig, SECTION_SNTP))
350  SNTP_SERVERS = *s;
351 
352  {
353  std::string dbPath;
354  if (getSingleSection (secConfig, "database_path", dbPath, j_))
355  {
356  boost::filesystem::path p(dbPath);
357  legacy("database_path",
358  boost::filesystem::absolute (p).string ());
359  }
360  }
361 
362  std::string strTemp;
363 
364  if (getSingleSection (secConfig, SECTION_PEER_PRIVATE, strTemp, j_))
365  PEER_PRIVATE = beast::lexicalCastThrow <bool> (strTemp);
366 
367  if (getSingleSection (secConfig, SECTION_PEERS_MAX, strTemp, j_))
368  PEERS_MAX = beast::lexicalCastThrow <std::size_t> (strTemp);
369 
370  if (getSingleSection (secConfig, SECTION_NODE_SIZE, strTemp, j_))
371  {
372  if (boost::iequals(strTemp, "tiny"))
373  NODE_SIZE = 0;
374  else if (boost::iequals(strTemp, "small"))
375  NODE_SIZE = 1;
376  else if (boost::iequals(strTemp, "medium"))
377  NODE_SIZE = 2;
378  else if (boost::iequals(strTemp, "large"))
379  NODE_SIZE = 3;
380  else if (boost::iequals(strTemp, "huge"))
381  NODE_SIZE = 4;
382  else
383  NODE_SIZE = std::min<std::size_t>(4,
384  beast::lexicalCastThrow<std::size_t>(strTemp));
385  }
386 
387  if (getSingleSection (secConfig, SECTION_SIGNING_SUPPORT, strTemp, j_))
388  signingEnabled_ = beast::lexicalCastThrow <bool> (strTemp);
389 
390  if (getSingleSection (secConfig, SECTION_ELB_SUPPORT, strTemp, j_))
391  ELB_SUPPORT = beast::lexicalCastThrow <bool> (strTemp);
392 
393  if (getSingleSection (secConfig, SECTION_WEBSOCKET_PING_FREQ, strTemp, j_))
394  WEBSOCKET_PING_FREQ = std::chrono::seconds{beast::lexicalCastThrow <int>(strTemp)};
395 
396  getSingleSection (secConfig, SECTION_SSL_VERIFY_FILE, SSL_VERIFY_FILE, j_);
397  getSingleSection (secConfig, SECTION_SSL_VERIFY_DIR, SSL_VERIFY_DIR, j_);
398 
399  if (getSingleSection (secConfig, SECTION_SSL_VERIFY, strTemp, j_))
400  SSL_VERIFY = beast::lexicalCastThrow <bool> (strTemp);
401 
402  if (exists(SECTION_VALIDATION_SEED) && exists(SECTION_VALIDATOR_TOKEN))
403  Throw<std::runtime_error> (
404  "Cannot have both [" SECTION_VALIDATION_SEED "] "
405  "and [" SECTION_VALIDATOR_TOKEN "] config sections");
406 
407  if (getSingleSection (secConfig, SECTION_NETWORK_QUORUM, strTemp, j_))
408  NETWORK_QUORUM = beast::lexicalCastThrow<std::size_t>(strTemp);
409 
410  if (getSingleSection (secConfig, SECTION_FEE_ACCOUNT_RESERVE, strTemp, j_))
411  FEE_ACCOUNT_RESERVE = beast::lexicalCastThrow <std::uint64_t>(strTemp);
412 
413  if (getSingleSection (secConfig, SECTION_FEE_OWNER_RESERVE, strTemp, j_))
414  FEE_OWNER_RESERVE = beast::lexicalCastThrow <std::uint64_t>(strTemp);
415 
416  if (getSingleSection (secConfig, SECTION_FEE_DEFAULT, strTemp, j_))
417  FEE_DEFAULT = beast::lexicalCastThrow <std::uint64_t>(strTemp);
418 
419  if (getSingleSection (secConfig, SECTION_LEDGER_HISTORY, strTemp, j_))
420  {
421  if (boost::iequals(strTemp, "full"))
422  LEDGER_HISTORY = 1000000000u;
423  else if (boost::iequals(strTemp, "none"))
424  LEDGER_HISTORY = 0;
425  else
426  LEDGER_HISTORY = beast::lexicalCastThrow <std::uint32_t> (strTemp);
427  }
428 
429  if (getSingleSection (secConfig, SECTION_FETCH_DEPTH, strTemp, j_))
430  {
431  if (boost::iequals(strTemp, "none"))
432  FETCH_DEPTH = 0;
433  else if (boost::iequals(strTemp, "full"))
434  FETCH_DEPTH = 1000000000u;
435  else
436  FETCH_DEPTH = beast::lexicalCastThrow <std::uint32_t> (strTemp);
437 
438  if (FETCH_DEPTH < 10)
439  FETCH_DEPTH = 10;
440  }
441 
442  if (getSingleSection (secConfig, SECTION_PATH_SEARCH_OLD, strTemp, j_))
443  PATH_SEARCH_OLD = beast::lexicalCastThrow <int> (strTemp);
444  if (getSingleSection (secConfig, SECTION_PATH_SEARCH, strTemp, j_))
445  PATH_SEARCH = beast::lexicalCastThrow <int> (strTemp);
446  if (getSingleSection (secConfig, SECTION_PATH_SEARCH_FAST, strTemp, j_))
447  PATH_SEARCH_FAST = beast::lexicalCastThrow <int> (strTemp);
448  if (getSingleSection (secConfig, SECTION_PATH_SEARCH_MAX, strTemp, j_))
449  PATH_SEARCH_MAX = beast::lexicalCastThrow <int> (strTemp);
450 
451  if (getSingleSection (secConfig, SECTION_DEBUG_LOGFILE, strTemp, j_))
452  DEBUG_LOGFILE = strTemp;
453 
454  if (getSingleSection (secConfig, SECTION_WORKERS, strTemp, j_))
455  WORKERS = beast::lexicalCastThrow <std::size_t> (strTemp);
456 
457  if (getSingleSection (secConfig, SECTION_COMPRESSION, strTemp, j_))
458  COMPRESSION = beast::lexicalCastThrow <bool> (strTemp);
459 
460  // Do not load trusted validator configuration for standalone mode
461  if (! RUN_STANDALONE)
462  {
463  // If a file was explicitly specified, then throw if the
464  // path is malformed or if the file does not exist or is
465  // not a file.
466  // If the specified file is not an absolute path, then look
467  // for it in the same directory as the config file.
468  // If no path was specified, then look for validators.txt
469  // in the same directory as the config file, but don't complain
470  // if we can't find it.
471  boost::filesystem::path validatorsFile;
472 
473  if (getSingleSection (secConfig, SECTION_VALIDATORS_FILE, strTemp, j_))
474  {
475  validatorsFile = strTemp;
476 
477  if (validatorsFile.empty ())
478  Throw<std::runtime_error> (
479  "Invalid path specified in [" SECTION_VALIDATORS_FILE "]");
480 
481  if (!validatorsFile.is_absolute() && !CONFIG_DIR.empty())
482  validatorsFile = CONFIG_DIR / validatorsFile;
483 
484  if (!boost::filesystem::exists (validatorsFile))
485  Throw<std::runtime_error> (
486  "The file specified in [" SECTION_VALIDATORS_FILE "] "
487  "does not exist: " + validatorsFile.string());
488 
489  else if (!boost::filesystem::is_regular_file (validatorsFile) &&
490  !boost::filesystem::is_symlink (validatorsFile))
491  Throw<std::runtime_error> (
492  "Invalid file specified in [" SECTION_VALIDATORS_FILE "]: " +
493  validatorsFile.string());
494  }
495  else if (!CONFIG_DIR.empty())
496  {
497  validatorsFile = CONFIG_DIR / validatorsFileName;
498 
499  if (!validatorsFile.empty ())
500  {
501  if(!boost::filesystem::exists (validatorsFile))
502  validatorsFile.clear();
503  else if (!boost::filesystem::is_regular_file (validatorsFile) &&
504  !boost::filesystem::is_symlink (validatorsFile))
505  validatorsFile.clear();
506  }
507  }
508 
509  if (!validatorsFile.empty () &&
510  boost::filesystem::exists (validatorsFile) &&
511  (boost::filesystem::is_regular_file (validatorsFile) ||
512  boost::filesystem::is_symlink (validatorsFile)))
513  {
514  boost::system::error_code ec;
515  auto const data = getFileContents(ec, validatorsFile);
516  if (ec)
517  {
518  Throw<std::runtime_error>("Failed to read '" +
519  validatorsFile.string() + "'." +
520  std::to_string(ec.value()) + ": " + ec.message());
521  }
522 
523  auto iniFile = parseIniFile (data, true);
524 
525  auto entries = getIniFileSection (
526  iniFile,
527  SECTION_VALIDATORS);
528 
529  if (entries)
530  section (SECTION_VALIDATORS).append (*entries);
531 
532  auto valKeyEntries = getIniFileSection(
533  iniFile,
534  SECTION_VALIDATOR_KEYS);
535 
536  if (valKeyEntries)
537  section (SECTION_VALIDATOR_KEYS).append (*valKeyEntries);
538 
539  auto valSiteEntries = getIniFileSection(
540  iniFile,
541  SECTION_VALIDATOR_LIST_SITES);
542 
543  if (valSiteEntries)
544  section (SECTION_VALIDATOR_LIST_SITES).append (*valSiteEntries);
545 
546  auto valListKeys = getIniFileSection(
547  iniFile,
548  SECTION_VALIDATOR_LIST_KEYS);
549 
550  if (valListKeys)
551  section (SECTION_VALIDATOR_LIST_KEYS).append (*valListKeys);
552 
553  if (!entries && !valKeyEntries && !valListKeys)
554  Throw<std::runtime_error> (
555  "The file specified in [" SECTION_VALIDATORS_FILE "] "
556  "does not contain a [" SECTION_VALIDATORS "], "
557  "[" SECTION_VALIDATOR_KEYS "] or "
558  "[" SECTION_VALIDATOR_LIST_KEYS "]"
559  " section: " +
560  validatorsFile.string());
561  }
562 
563  // Consolidate [validator_keys] and [validators]
564  section (SECTION_VALIDATORS).append (
565  section (SECTION_VALIDATOR_KEYS).lines ());
566 
567  if (! section (SECTION_VALIDATOR_LIST_SITES).lines().empty() &&
568  section (SECTION_VALIDATOR_LIST_KEYS).lines().empty())
569  {
570  Throw<std::runtime_error> (
571  "[" + std::string(SECTION_VALIDATOR_LIST_KEYS) +
572  "] config section is missing");
573  }
574  }
575 
576  {
577  auto const part = section("features");
578  for(auto const& s : part.values())
579  {
580  if (auto const f = getRegisteredFeature(s))
581  features.insert(*f);
582  else
583  Throw<std::runtime_error>(
584  "Unknown feature: " + s + " in config file.");
585  }
586  }
587 
588  // This doesn't properly belong here, but check to make sure that the
589  // value specified for network_quorum is achievable:
590  {
591  auto pm = PEERS_MAX;
592 
593  // FIXME this apparently magic value is actually defined as a constant
594  // elsewhere (see defaultMaxPeers) but we handle this check here.
595  if (pm == 0)
596  pm = 21;
597 
598  if (NETWORK_QUORUM > pm)
599  {
600  Throw<std::runtime_error>(
601  "The minimum number of required peers (network_quorum) exceeds "
602  "the maximum number of allowed peers (peers_max)");
603  }
604  }
605 }
606 
607 boost::filesystem::path Config::getDebugLogFile () const
608 {
609  auto log_file = DEBUG_LOGFILE;
610 
611  if (!log_file.empty () && !log_file.is_absolute ())
612  {
613  // Unless an absolute path for the log file is specified, the
614  // path is relative to the config file directory.
615  log_file = boost::filesystem::absolute (
616  log_file, CONFIG_DIR);
617  }
618 
619  if (!log_file.empty ())
620  {
621  auto log_dir = log_file.parent_path ();
622 
623  if (!boost::filesystem::is_directory (log_dir))
624  {
625  boost::system::error_code ec;
626  boost::filesystem::create_directories (log_dir, ec);
627 
628  // If we fail, we warn but continue so that the calling code can
629  // decide how to handle this situation.
630  if (ec)
631  {
632  std::cerr <<
633  "Unable to create log file path " << log_dir <<
634  ": " << ec.message() << '\n';
635  }
636  }
637  }
638 
639  return log_file;
640 }
641 
642 int
643 Config::getValueFor(SizedItem item, boost::optional<std::size_t> node) const
644 {
645  auto const index = static_cast<std::underlying_type_t<SizedItem>>(item);
646  assert(index < sizedItems.size());
647  assert(!node || *node <= 4);
648  return sizedItems.at(index).second.at(node.value_or(NODE_SIZE));
649 }
650 
651 } // ripple
ripple::sizedItems
constexpr std::array< std::pair< SizedItem, std::array< int, 5 > >, 11 > sizedItems
Definition: Config.cpp:45
fstream
std::string
STL class.
ripple::SizedItem
SizedItem
Definition: Config.h:47
ripple::Config::PATH_SEARCH
int PATH_SEARCH
Definition: Config.h:153
ripple::SizedItem::nodeCacheSize
@ nodeCacheSize
ripple::Config::validatorsFileName
static char const *const validatorsFileName
Definition: Config.h:73
std::vector< std::string >
std::map::find
T find(T... args)
std::string::size
T size(T... args)
ripple::Config::SSL_VERIFY_DIR
std::string SSL_VERIFY_DIR
Definition: Config.h:172
ripple::Config::getValueFor
int getValueFor(SizedItem item, boost::optional< std::size_t > node=boost::none) const
Retrieve the default value for the item at the specified node size.
Definition: Config.cpp:643
ripple::Config::CONFIG_FILE
boost::filesystem::path CONFIG_FILE
Definition: Config.h:79
std::chrono::seconds
ripple::Config::NODE_SIZE
std::size_t NODE_SIZE
Definition: Config.h:168
iterator
ripple::Config::PEER_PRIVATE
bool PEER_PRIVATE
Definition: Config.h:146
ripple::Config::DEBUG_LOGFILE
boost::filesystem::path DEBUG_LOGFILE
Definition: Config.h:83
std::map::emplace
T emplace(T... args)
ripple::Config::setupControl
void setupControl(bool bQuiet, bool bSilent, bool bStandalone)
Definition: Config.cpp:205
ripple::SizedItem::treeCacheAge
@ treeCacheAge
beast::Journal::warn
Stream warn() const
Definition: Journal.h:302
ripple::FeeUnit32
FeeUnit< std::uint32_t > FeeUnit32
Definition: FeeUnits.h:476
std::cerr
ripple::SizedItem::nodeCacheAge
@ nodeCacheAge
ripple::SizedItem::hashNodeDBCache
@ hashNodeDBCache
iostream
ripple::SizedItem::ledgerFetch
@ ledgerFetch
ripple::Config::FETCH_DEPTH
std::uint32_t FETCH_DEPTH
Definition: Config.h:166
algorithm
ripple::Config::PATH_SEARCH_MAX
int PATH_SEARCH_MAX
Definition: Config.h:155
ripple::Section::append
void append(std::vector< std::string > const &lines)
Append a set of lines to this section.
Definition: BasicConfig.cpp:41
std::underlying_type_t
ripple::Config::RUN_STANDALONE
bool RUN_STANDALONE
Operate in stand-alone mode.
Definition: Config.h:99
ripple::Config::load
void load()
Definition: Config.cpp:316
ripple::Config::j_
const beast::Journal j_
Definition: Config.h:86
ripple::Config::SSL_VERIFY_FILE
std::string SSL_VERIFY_FILE
Definition: Config.h:171
ripple::Config::loadFromString
void loadFromString(std::string const &fileContents)
Load the config from the contents of the string.
Definition: Config.cpp:337
ripple::Config::TRANSACTION_FEE_BASE
static constexpr FeeUnit32 TRANSACTION_FEE_BASE
Definition: Config.h:137
ripple::Config::SNTP_SERVERS
std::vector< std::string > SNTP_SERVERS
Definition: Config.h:117
ripple::Config::WEBSOCKET_PING_FREQ
std::chrono::seconds WEBSOCKET_PING_FREQ
Definition: Config.h:149
ripple::Config::IPS_FIXED
std::vector< std::string > IPS_FIXED
Definition: Config.h:116
ripple::Config::FEE_OWNER_RESERVE
XRPAmount FEE_OWNER_RESERVE
Definition: Config.h:162
ripple::Config::SSL_VERIFY
bool SSL_VERIFY
Definition: Config.h:170
ripple::BasicConfig::build
void build(IniFileSections const &ifs)
Definition: BasicConfig.cpp:185
std::to_string
T to_string(T... args)
ripple::Config::FEE_ACCOUNT_RESERVE
XRPAmount FEE_ACCOUNT_RESERVE
Definition: Config.h:161
std::array
STL class.
ripple::BasicConfig::legacy
void legacy(std::string const &section, std::string value)
Set a value that is not a key/value pair.
Definition: BasicConfig.cpp:173
ripple::SizedItem::lgrDBCache
@ lgrDBCache
beast::Journal
A generic endpoint for log messages.
Definition: Journal.h:60
ripple::Config::databaseDirName
static char const *const databaseDirName
Definition: Config.h:72
std::map
STL class.
ripple::getFileContents
std::string getFileContents(boost::system::error_code &ec, boost::filesystem::path const &sourcePath, boost::optional< std::size_t > maxSize=boost::none)
Definition: FileUtilities.cpp:25
ripple::SizedItem::txnDBCache
@ txnDBCache
ripple::Config::WORKERS
std::size_t WORKERS
Definition: Config.h:178
ripple::Config::PATH_SEARCH_OLD
int PATH_SEARCH_OLD
Definition: Config.h:152
ripple::Config::LEDGER_HISTORY
std::uint32_t LEDGER_HISTORY
Definition: Config.h:165
ripple::parseIniFile
IniFileSections parseIniFile(std::string const &strInput, const bool bTrim)
Definition: Config.cpp:97
ripple::Config::NETWORK_QUORUM
std::size_t NETWORK_QUORUM
Definition: Config.h:141
ripple::Config::CONFIG_DIR
boost::filesystem::path CONFIG_DIR
Definition: Config.h:81
std::string::substr
T substr(T... args)
ripple::Config::PEERS_MAX
std::size_t PEERS_MAX
Definition: Config.h:147
ripple::Config::FEE_DEFAULT
XRPAmount FEE_DEFAULT
Definition: Config.h:160
ripple
Use hash_* containers for keys that do not need a cryptographically secure hashing algorithm.
Definition: RCLCensorshipDetector.h:29
ripple::Config::features
std::unordered_set< uint256, beast::uhash<> > features
Definition: Config.h:183
ripple::Config::PATH_SEARCH_FAST
int PATH_SEARCH_FAST
Definition: Config.h:154
ripple::getSingleSection
bool getSingleSection(IniFileSections &secSource, std::string const &strSection, std::string &strValue, beast::Journal j)
Definition: Config.cpp:158
ripple::Config::setup
void setup(std::string const &strConf, bool bQuiet, bool bSilent, bool bStandalone)
Definition: Config.cpp:213
std::endl
T endl(T... args)
ripple::getEnvVar
static std::string getEnvVar(char const *name)
Definition: Config.cpp:191
ripple::SizedItem::treeCacheSize
@ treeCacheSize
ripple::SizedItem::sweepInterval
@ sweepInterval
ripple::Config::COMPRESSION
bool COMPRESSION
Definition: Config.h:175
std::string::empty
T empty(T... args)
ripple::systemName
static std::string const & systemName()
Definition: SystemParameters.h:34
ripple::SizedItem::ledgerSize
@ ledgerSize
ripple::Config::IPS
std::vector< std::string > IPS
Definition: Config.h:115
ripple::Config::configFileName
static char const *const configFileName
Definition: Config.h:71
std::map::end
T end(T... args)
ripple::Config::QUIET
bool QUIET
Definition: Config.h:88
ripple::Config::SILENT
bool SILENT
Definition: Config.h:89
ripple::Config::getDebugLogFile
boost::filesystem::path getDebugLogFile() const
Returns the full path and filename of the debug log file.
Definition: Config.cpp:607
ripple::Config::signingEnabled_
bool signingEnabled_
Determines if the server will sign a tx, given an account's secret seed.
Definition: Config.h:107
ripple::Config::ELB_SUPPORT
bool ELB_SUPPORT
Definition: Config.h:113
ripple::HTTPClient::initializeSSLContext
static void initializeSSLContext(Config const &config, beast::Journal j)
Definition: HTTPClient.cpp:37
ripple::getIniFileSection
IniFileSections::mapped_type * getIniFileSection(IniFileSections &secSource, std::string const &strSection)
Definition: Config.cpp:146
ripple::BasicConfig::exists
bool exists(std::string const &name) const
Returns true if a section with the given name exists.
Definition: BasicConfig.cpp:134
ripple::SizedItem::ledgerAge
@ ledgerAge
ripple::BasicConfig::section
Section & section(std::string const &name)
Returns the section with the given name.
Definition: BasicConfig.cpp:140
ripple::IniFileSections
std::map< std::string, std::vector< std::string > > IniFileSections
Definition: BasicConfig.h:36
ripple::getRegisteredFeature
boost::optional< uint256 > getRegisteredFeature(std::string const &name)
Definition: Feature.cpp:141