Add config option [database_path].

This commit is contained in:
Arthur Britto
2013-01-04 16:01:55 -08:00
parent 2746806cd3
commit dfd3994921
3 changed files with 19 additions and 8 deletions

View File

@@ -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

View File

@@ -13,6 +13,7 @@
#include <algorithm>
#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);

View File

@@ -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