userver: userver/components/dump_configurator.hpp Source File
Loading...
Searching...
No Matches
dump_configurator.hpp
1#pragma once
2
3#include <string>
4
5#include <userver/components/component_base.hpp>
6#include <userver/components/component_fwd.hpp>
7
8USERVER_NAMESPACE_BEGIN
9
10namespace components {
11
12// clang-format off
13
14/// @ingroup userver_components
15///
16/// @brief Helper component that manages common configuration for userver dumps.
17///
18/// The component must be configured in service config.
19///
20/// ## Static options:
21/// Name | Description | Default value
22/// ---- | ----------- | -------------
23/// dump-root | Components store dumps in subdirectories of this directory | -
24///
25/// ## Config example:
26///
27/// @snippet components/common_component_list_test.cpp Sample dump configurator component config
28
29// clang-format on
30class DumpConfigurator final : public ComponentBase {
31public:
32 /// @ingroup userver_component_names
33 /// @brief The default name of components::DumpConfigurator component
34 static constexpr std::string_view kName = "dump-configurator";
35
36 DumpConfigurator(const ComponentConfig& config, const ComponentContext& context);
37
38 const std::string& GetDumpRoot() const;
39
40 static yaml_config::Schema GetStaticConfigSchema();
41
42private:
43 const std::string dump_root_;
44};
45
46template <>
47inline constexpr bool kHasValidate<DumpConfigurator> = true;
48
49} // namespace components
50
51USERVER_NAMESPACE_END