#include <userver/dynamic_config/storage/component.hpp>
Component that stores the dynamic config.
Note that the service with updates-enabled: true
and without configs cache requires successful update to start. See dynamic_config_fallback for details and explanation.
If a config variable is entirely missing the fetched config, the value from dynamic_config_fallback.json
is used (see fallback-path
static config option).
If a config variable from the fetched config fails to be parsed (the parser fails with an exception), then the whole config update fails. It means that:
cache.any.time.time-from-last-successful-start-ms
Name | Description | Default value |
---|---|---|
updates-enabled | should be set to 'true' if there is an updater component | false |
defaults | overrides the defaults from dynamic_config::Key definitions in code | {} |
fallback-path | a path to the fallback config | defaults are taken from dynamic_config::Key definitions |
fs-cache-path | path to the file to read and dump a config cache; set to empty string to disable reading and dumping configs to FS | cache is disabled |
fs-task-processor | name of the task processor to run the blocking file write operations | required if fs-cache-path is present |
Definition at line 67 of file component.hpp.
Classes | |
class | NoblockSubscriber |
Allows to subscribe to DynamicConfig updates without waiting for the first update to complete. Primarily intended for internal use. More... | |
Public Member Functions | |
DynamicConfig (const ComponentConfig &, const ComponentContext &) | |
dynamic_config::Source | GetSource () |
const dynamic_config::DocsMap & | GetDefaultDocsMap () const |
Public Member Functions inherited from components::DynamicConfigUpdatesSinkBase | |
DynamicConfigUpdatesSinkBase (const components::ComponentConfig &, const components::ComponentContext &) | |
Public Member Functions inherited from components::LoggableComponentBase | |
LoggableComponentBase (const ComponentConfig &, const ComponentContext &) | |
LoggableComponentBase (LoggableComponentBase &&)=delete | |
LoggableComponentBase (const LoggableComponentBase &)=delete | |
~LoggableComponentBase () override=default | |
ComponentHealth | GetComponentHealth () const override |
void | OnLoadingCancelled () override |
void | OnAllComponentsLoaded () override |
void | OnAllComponentsAreStopping () override |
Static Public Member Functions | |
static yaml_config::Schema | GetStaticConfigSchema () |
Static Public Member Functions inherited from components::LoggableComponentBase | |
static yaml_config::Schema | GetStaticConfigSchema () |
Static Public Attributes | |
static constexpr std::string_view | kName = "dynamic-config" |
The default name of components::DynamicConfig. | |
const dynamic_config::DocsMap & components::DynamicConfig::GetDefaultDocsMap | ( | ) | const |
Get config defaults with overrides applied. Useful in the implementation of custom config clients. Most code does not need to deal with these
dynamic_config::Source components::DynamicConfig::GetSource | ( | ) |
Use dynamic_config::Source
to get up-to-date config values, or to do something special on config updates