Changeset View
Changeset View
Standalone View
Standalone View
src/util/system.cpp
Show First 20 Lines • Show All 1,008 Lines • ▼ Show 20 Lines | bool ArgsManager::ReadConfigFiles(std::string &error, | ||||
const std::string confPath = GetArg("-conf", BITCOIN_CONF_FILENAME); | const std::string confPath = GetArg("-conf", BITCOIN_CONF_FILENAME); | ||||
fsbridge::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, confPath, error, ignore_invalid_keys)) { | if (!ReadConfigStream(stream, confPath, error, ignore_invalid_keys)) { | ||||
return false; | return false; | ||||
} | } | ||||
// if there is an -includeconf in the override args, but it is empty, | // `-includeconf` cannot be included in the command line arguments | ||||
// that means the user passed '-noincludeconf' on the command line, in | // except as `-noincludeconf` (which indicates that no conf file should | ||||
// which case we should not include anything | // be used). | ||||
bool emptyIncludeConf; | bool use_conf_file{true}; | ||||
{ | { | ||||
LOCK(cs_args); | LOCK(cs_args); | ||||
emptyIncludeConf = m_override_args.count("-includeconf") == 0; | auto it = m_override_args.find("-includeconf"); | ||||
if (it != m_override_args.end()) { | |||||
// ParseParameters() fails if a non-negated -includeconf is | |||||
// passed on the command-line | |||||
assert(it->second.empty()); | |||||
use_conf_file = false; | |||||
} | |||||
} | } | ||||
if (emptyIncludeConf) { | if (use_conf_file) { | ||||
std::string chain_id = GetChainName(); | std::string chain_id = GetChainName(); | ||||
std::vector<std::string> includeconf(GetArgs("-includeconf")); | std::vector<std::string> includeconf(GetArgs("-includeconf")); | ||||
{ | { | ||||
// We haven't set m_network yet (that happens in | // We haven't set m_network yet (that happens in | ||||
// SelectParams()), so manually check for network.includeconf | // SelectParams()), so manually check for network.includeconf | ||||
// args. | // args. | ||||
std::vector<std::string> includeconf_net( | std::vector<std::string> includeconf_net( | ||||
GetArgs(std::string("-") + chain_id + ".includeconf")); | GetArgs(std::string("-") + chain_id + ".includeconf")); | ||||
▲ Show 20 Lines • Show All 371 Lines • Show Last 20 Lines |