| 92 | } |
| 93 | |
| 94 | bool 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 | |
| 123 | bool ArgsManager::ReadConfigString(const std::string& str_config) |
| 124 | { |