From dfd39949218088ddadd79ed68f2e7c54e109568e Mon Sep 17 00:00:00 2001 From: Arthur Britto Date: Fri, 4 Jan 2013 16:01:55 -0800 Subject: [PATCH 1/3] Add config option [database_path]. --- rippled-example.cfg | 8 ++++++-- src/cpp/ripple/Config.cpp | 16 ++++++++++------ src/cpp/ripple/Config.h | 3 +++ 3 files changed, 19 insertions(+), 8 deletions(-) diff --git a/rippled-example.cfg b/rippled-example.cfg index c37cd9c0e..43bd2944c 100644 --- a/rippled-example.cfg +++ b/rippled-example.cfg @@ -102,7 +102,7 @@ # # [websocket_ssl]: # 0 or 1. -# Enable websocket SSL +# Enable websocket SSL. # # [websocket_ssl_key]: # Specify the filename holding the SSL key in PEM format. @@ -128,7 +128,11 @@ # past ledgers to acquire on server startup and the minimum to maintain while # running. Servers that don't need to serve clients can set this to "none". # Servers that want complete history can set this to "full". -# The default is 256 ledgers +# The default is 256 ledgers. +# +# [database_path]: +# Full path of database directory. +# [peer_ip] 0.0.0.0 diff --git a/src/cpp/ripple/Config.cpp b/src/cpp/ripple/Config.cpp index ff9c161a2..a13e1e0e7 100644 --- a/src/cpp/ripple/Config.cpp +++ b/src/cpp/ripple/Config.cpp @@ -13,6 +13,7 @@ #include #define SECTION_ACCOUNT_PROBE_MAX "account_probe_max" +#define SECTION_DATABASE_PATH "database_path" #define SECTION_DEBUG_LOGFILE "debug_logfile" #define SECTION_FEE_DEFAULT "fee_default" #define SECTION_FEE_NICKNAME_CREATE "fee_nickname_create" @@ -142,17 +143,17 @@ void Config::setup(const std::string& strConf, bool bTestNet, bool bQuiet) } } - boost::filesystem::create_directories(DATA_DIR, ec); - - if (ec) - throw std::runtime_error(str(boost::format("Can not create %s") % DATA_DIR)); + // Update default values + load(); // std::cerr << "CONFIG FILE: " << CONFIG_FILE << std::endl; // std::cerr << "CONFIG DIR: " << CONFIG_DIR << std::endl; // std::cerr << "DATA DIR: " << DATA_DIR << std::endl; - // Update default values - load(); + boost::filesystem::create_directories(DATA_DIR, ec); + + if (ec) + throw std::runtime_error(str(boost::format("Can not create %s") % DATA_DIR)); } Config::Config() @@ -259,6 +260,9 @@ void Config::load() SNTP_SERVERS = *smtTmp; } + if (sectionSingleB(secConfig, SECTION_DATABASE_PATH, DATABASE_PATH)) + DATA_DIR = DATABASE_PATH; + (void) sectionSingleB(secConfig, SECTION_VALIDATORS_SITE, VALIDATORS_SITE); (void) sectionSingleB(secConfig, SECTION_PEER_IP, PEER_IP); diff --git a/src/cpp/ripple/Config.h b/src/cpp/ripple/Config.h index d43de2a6c..849d18852 100644 --- a/src/cpp/ripple/Config.h +++ b/src/cpp/ripple/Config.h @@ -65,6 +65,9 @@ public: enum StartUpType { FRESH, NORMAL, LOAD, NETWORK }; StartUpType START_UP; + // Database + std::string DATABASE_PATH; + // Network parameters int NETWORK_START_TIME; // The Unix time we start ledger 0. int TRANSACTION_FEE_BASE; // The number of fee units a reference transaction costs From 648f3c4a490cbefa8ad16c689c5dba38422533ce Mon Sep 17 00:00:00 2001 From: Arthur Britto Date: Fri, 4 Jan 2013 16:08:24 -0800 Subject: [PATCH 2/3] Note domains not allowed for [ips]. --- rippled-example.cfg | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/rippled-example.cfg b/rippled-example.cfg index 43bd2944c..8b315b528 100644 --- a/rippled-example.cfg +++ b/rippled-example.cfg @@ -52,10 +52,10 @@ # # [ips]: # Only valid in "rippled.cfg", "ripple.txt", and the referered [ips_url]. -# List of ips where the Ripple protocol is avialable. -# One ipv4 or ipv6 address per line. -# A port may optionally be specified after adding a space to the address. -# By convention, if known, IPs are listed in from most to least trusted. +# List of ips where the Ripple protocol is avialable. Domain names are not +# allowed. One ipv4 or ipv6 address per line. A port may optionally be +# specified after adding a space to the address. By convention, if known, +# IPs are listed in from most to least trusted. # # Examples: # 192.168.0.1 From 0d40531dd76b520e2cd36596933dcc0b797c0d72 Mon Sep 17 00:00:00 2001 From: Arthur Britto Date: Fri, 4 Jan 2013 17:47:54 -0800 Subject: [PATCH 3/3] Remove bad example from rippled-example.cfg. --- rippled-example.cfg | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/rippled-example.cfg b/rippled-example.cfg index 8b315b528..9f28dab46 100644 --- a/rippled-example.cfg +++ b/rippled-example.cfg @@ -167,7 +167,7 @@ pool.ntp.org [validation_seed] shh1D4oj5czH3PUEjYES8c7Bay3tE -[unl_default] +[validators_file] validators.txt [ips]