![]() |
Bitcoin Core
25.99.0
P2P Digital Currency
|
Classes | |
struct | ConfigError |
struct | Settings |
Stored settings. More... | |
struct | SettingsSpan |
Accessor for list of settings that skips negated values when iterated over. More... | |
Typedefs | |
using | SettingsAbortFn = std::function< bool(const bilingual_str &message, const std::vector< std::string > &details)> |
Callback function to let the user decide whether to abort loading if settings.json file exists and can't be parsed, or to ignore the error and overwrite the file. More... | |
using | SettingsValue = UniValue |
Settings value type (string/integer/boolean/null variant). More... | |
Enumerations | |
enum class | ConfigStatus { FAILED , FAILED_WRITE , ABORTED } |
Functions | |
std::optional< ConfigError > | InitConfig (ArgsManager &args, SettingsAbortFn settings_abort_fn) |
bool | ReadSettings (const fs::path &path, std::map< std::string, SettingsValue > &values, std::vector< std::string > &errors) |
Read settings file. More... | |
bool | WriteSettings (const fs::path &path, const std::map< std::string, SettingsValue > &values, std::vector< std::string > &errors) |
Write settings file. More... | |
SettingsValue | GetSetting (const Settings &settings, const std::string §ion, const std::string &name, bool ignore_default_section_config, bool ignore_nonpersistent, bool get_chain_type) |
Get settings value from combined sources: forced settings, command line arguments, runtime read-write settings, and the read-only config file. More... | |
std::vector< SettingsValue > | GetSettingsList (const Settings &settings, const std::string §ion, const std::string &name, bool ignore_default_section_config) |
Get combined setting value similar to GetSetting(), except if setting was specified multiple times, return a list of all the values specified. More... | |
bool | OnlyHasDefaultSectionSetting (const Settings &settings, const std::string §ion, const std::string &name) |
Return true if a setting is set in the default config file section, and not overridden by a higher priority command-line or network section value. More... | |
template<typename Map , typename Key > | |
auto | FindKey (Map &&map, Key &&key) -> decltype(&map.at(key)) |
Map lookup helper. More... | |
using common::SettingsAbortFn = typedef std::function<bool(const bilingual_str& message, const std::vector<std::string>& details)> |
using common::SettingsValue = typedef UniValue |
Settings value type (string/integer/boolean/null variant).
Definition at line 28 of file settings.h.
|
strong |
auto common::FindKey | ( | Map && | map, |
Key && | key | ||
) | -> decltype(&map.at(key)) |
Map lookup helper.
Definition at line 107 of file settings.h.
SettingsValue common::GetSetting | ( | const Settings & | settings, |
const std::string & | section, | ||
const std::string & | name, | ||
bool | ignore_default_section_config, | ||
bool | ignore_nonpersistent, | ||
bool | get_chain_type | ||
) |
Get settings value from combined sources: forced settings, command line arguments, runtime read-write settings, and the read-only config file.
ignore_default_section_config | - ignore values in the default section of the config file (part before any [section] keywords) |
ignore_nonpersistent | - ignore non-persistent settings values (forced settings values and values specified on the command line). Only return settings in the read-only config and read-write settings files. |
get_chain_type | - enable special backwards compatible behavior for GetChainType |
Definition at line 131 of file settings.cpp.
std::vector< SettingsValue > common::GetSettingsList | ( | const Settings & | settings, |
const std::string & | section, | ||
const std::string & | name, | ||
bool | ignore_default_section_config | ||
) |
Get combined setting value similar to GetSetting(), except if setting was specified multiple times, return a list of all the values specified.
Definition at line 188 of file settings.cpp.
std::optional< ConfigError > common::InitConfig | ( | ArgsManager & | args, |
SettingsAbortFn | settings_abort_fn | ||
) |
bool common::OnlyHasDefaultSectionSetting | ( | const Settings & | settings, |
const std::string & | section, | ||
const std::string & | name | ||
) |
Return true if a setting is set in the default config file section, and not overridden by a higher priority command-line or network section value.
This is used to provide user warnings about values that might be getting ignored unintentionally.
Definition at line 233 of file settings.cpp.
bool common::ReadSettings | ( | const fs::path & | path, |
std::map< std::string, SettingsValue > & | values, | ||
std::vector< std::string > & | errors | ||
) |
Read settings file.
Definition at line 67 of file settings.cpp.
bool common::WriteSettings | ( | const fs::path & | path, |
const std::map< std::string, SettingsValue > & | values, | ||
std::vector< std::string > & | errors | ||
) |
Write settings file.
Definition at line 112 of file settings.cpp.