| 918 | } |
| 919 | |
| 920 | bool 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 | |
| 948 | bool ArgsManager::ReadConfigFiles(std::string& error, bool ignore_invalid_keys) |
| 949 | { |