#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 |
void | OnAllComponentsLoaded () override |
void | OnAllComponentsAreStopping () override |
Static Public Member Functions | |
static yaml_config::Schema | GetStaticConfigSchema () |
Static Public Attributes | |
static constexpr std::string_view | kName = "dynamic-config" |
The default name of components::DynamicConfig. | |
Protected Types | |
using | LoggableComponentBase = ComponentBase |
Legacy alias, use ComponentBase instead. | |
|
protectedinherited |
Legacy alias, use ComponentBase instead.
Definition at line 67 of file component_base.hpp.
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
|
inlineoverridevirtualinherited |
Component may use this function to stop doing work before the stop of the components that depend on it.
Base components may override it and make final
to do some work before the derived object constructor is called. Don't use it otherwise.
Reimplemented from components::RawComponentBase.
Reimplemented in urabbitmq::ConsumerComponentBase, and components::Server.
Definition at line 58 of file component_base.hpp.
|
inlineoverridevirtualinherited |
Component may use this function to finalize registration of other components that depend on it (for example, handler components register in server component, and the latter uses OnAllComponentsLoaded() to start processing requests).
Base components may override it and make final
to do some work after the derived object constructor is called. Don't use it otherwise.
Reimplemented from components::RawComponentBase.
Reimplemented in urabbitmq::ConsumerComponentBase, components::Server, and server::handlers::Ping.
Definition at line 51 of file component_base.hpp.