Changeset View
Changeset View
Standalone View
Standalone View
src/util/system.cpp
Show First 20 Lines • Show All 957 Lines • ▼ Show 20 Lines | |||||
bool ArgsManager::ReadConfigFiles(std::string &error, | bool ArgsManager::ReadConfigFiles(std::string &error, | ||||
bool ignore_invalid_keys) { | bool ignore_invalid_keys) { | ||||
{ | { | ||||
LOCK(cs_args); | LOCK(cs_args); | ||||
m_config_args.clear(); | m_config_args.clear(); | ||||
} | } | ||||
const std::string confPath = GetArg("-conf", BITCOIN_CONF_FILENAME); | const std::string confPath = GetArg("-conf", BITCOIN_CONF_FILENAME); | ||||
fs::ifstream stream(GetConfigFile(confPath)); | fsbridge::ifstream stream(GetConfigFile(confPath)); | ||||
// ok to not have a config file | // ok to not have a config file | ||||
if (stream.good()) { | if (stream.good()) { | ||||
if (!ReadConfigStream(stream, error, ignore_invalid_keys)) { | if (!ReadConfigStream(stream, error, ignore_invalid_keys)) { | ||||
return false; | return false; | ||||
} | } | ||||
// if there is an -includeconf in the override args, but it is empty, | // if there is an -includeconf in the override args, but it is empty, | ||||
// that means the user passed '-noincludeconf' on the command line, in | // that means the user passed '-noincludeconf' on the command line, in | ||||
Show All 21 Lines | if (stream.good()) { | ||||
{ | { | ||||
LOCK(cs_args); | LOCK(cs_args); | ||||
m_config_args.erase("-includeconf"); | m_config_args.erase("-includeconf"); | ||||
m_config_args.erase(std::string("-") + chain_id + | m_config_args.erase(std::string("-") + chain_id + | ||||
".includeconf"); | ".includeconf"); | ||||
} | } | ||||
for (const std::string &to_include : includeconf) { | for (const std::string &to_include : includeconf) { | ||||
fs::ifstream include_config(GetConfigFile(to_include)); | fsbridge::ifstream include_config(GetConfigFile(to_include)); | ||||
if (include_config.good()) { | if (include_config.good()) { | ||||
if (!ReadConfigStream(include_config, error, | if (!ReadConfigStream(include_config, error, | ||||
ignore_invalid_keys)) { | ignore_invalid_keys)) { | ||||
return false; | return false; | ||||
} | } | ||||
LogPrintf("Included configuration file %s\n", | LogPrintf("Included configuration file %s\n", | ||||
to_include.c_str()); | to_include.c_str()); | ||||
} else { | } else { | ||||
▲ Show 20 Lines • Show All 378 Lines • Show Last 20 Lines |