MCPcopy Create free account
hub / github.com/bitcoin/bitcoin / ReadConfigStream

Method ReadConfigStream

src/common/config.cpp:94–121  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

92}
93
94bool ArgsManager::ReadConfigStream(std::istream& stream, const std::string& filepath, std::string& error, bool ignore_invalid_keys)
95{
96 LOCK(cs_args);
97 std::vector<std::pair<std::string, std::string>> options;
98 if (!GetConfigOptions(stream, filepath, error, options, m_config_sections)) {
99 return false;
100 }
101 for (const std::pair<std::string, std::string>& option : options) {
102 KeyInfo key = InterpretKey(option.first);
103 std::optional<unsigned int> flags = GetArgFlags_('-' + key.name);
104 if (!IsConfSupported(key, error)) return false;
105 if (flags) {
106 std::optional<common::SettingsValue> value = InterpretValue(key, &option.second, *flags, error);
107 if (!value) {
108 return false;
109 }
110 m_settings.ro_config[key.section][key.name].push_back(*value);
111 } else {
112 if (ignore_invalid_keys) {
113 LogWarning("Ignoring unknown configuration value %s", option.first);
114 } else {
115 error = strprintf("Invalid configuration value %s", option.first);
116 return false;
117 }
118 }
119 }
120 return true;
121}
122
123bool ArgsManager::ReadConfigString(const std::string& str_config)
124{

Callers 1

BOOST_FIXTURE_TEST_CASEFunction · 0.80

Calls 5

GetConfigOptionsFunction · 0.85
InterpretKeyFunction · 0.85
IsConfSupportedFunction · 0.85
InterpretValueFunction · 0.85
push_backMethod · 0.45

Tested by 1

BOOST_FIXTURE_TEST_CASEFunction · 0.64