diff --git a/rippled-example.cfg b/rippled-example.cfg index c37cd9c0ec..43bd2944c1 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 ff9c161a2d..a13e1e0e73 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 d43de2a6c3..849d188524 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