MCPcopy Create free account
hub / github.com/ElementsProject/elements / ReadConfigStream

Method ReadConfigStream

src/util/system.cpp:920–946  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

918}
919
920bool ArgsManager::ReadConfigStream(std::istream& stream, const std::string& filepath, std::string& error, bool ignore_invalid_keys)
921{
922 LOCK(cs_args);
923 std::vector<std::pair<std::string, std::string>> options;
924 if (!GetConfigOptions(stream, filepath, error, options, m_config_sections)) {
925 return false;
926 }
927 for (const std::pair<std::string, std::string>& option : options) {
928 KeyInfo key = InterpretKey(option.first);
929 std::optional<unsigned int> flags = GetArgFlags('-' + key.name);
930 if (flags) {
931 std::optional<util::SettingsValue> value = InterpretValue(key, option.second, *flags, error);
932 if (!value) {
933 return false;
934 }
935 m_settings.ro_config[key.section][key.name].push_back(*value);
936 } else {
937 if (ignore_invalid_keys) {
938 LogPrintf("Ignoring unknown configuration value %s\n", option.first);
939 } else {
940 error = strprintf("Invalid configuration value %s", option.first);
941 return false;
942 }
943 }
944 }
945 return true;
946}
947
948bool ArgsManager::ReadConfigFiles(std::string& error, bool ignore_invalid_keys)
949{

Callers 1

BOOST_FIXTURE_TEST_CASEFunction · 0.80

Calls 4

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

Tested by 1

BOOST_FIXTURE_TEST_CASEFunction · 0.64