userver: userver/storages/secdist/component.hpp Source File
Loading...
Searching...
No Matches
component.hpp
Go to the documentation of this file.
1#pragma once
2
3/// @file userver/storages/secdist/component.hpp
4/// @brief @copybrief components::Secdist
5
6#include <string>
7
8#include <userver/components/component_base.hpp>
9#include <userver/storages/secdist/secdist.hpp>
10
11USERVER_NAMESPACE_BEGIN
12
13namespace components {
14
15/// @ingroup userver_components
16///
17/// @brief Component that stores security related data (keys, passwords, ...).
18///
19/// The component must be configured in service config.
20///
21/// Secdist requires a provider @ref storages::secdist::SecdistProvider
22/// You can implement your own or use @ref components::DefaultSecdistProvider.
23///
24/// ## Static configuration example:
25///
26/// @snippet samples/redis_service/static_config.yaml Sample secdist static config
27///
28/// ## Static options of components::Secdist :
29/// @include{doc} scripts/docs/en/components_schema/core/src/storages/secdist/component.md
30///
31/// Options inherited from @ref components::ComponentBase :
32/// @include{doc} scripts/docs/en/components_schema/core/src/components/impl/component_base.md
33class Secdist final : public ComponentBase {
34public:
35 /// @ingroup userver_component_names
36 /// @brief The default name of @ref components::Secdist
37 static constexpr std::string_view kName = "secdist";
38
39 Secdist(const ComponentConfig&, const ComponentContext&);
40
41 const storages::secdist::SecdistConfig& Get() const;
42
43 rcu::ReadablePtr<storages::secdist::SecdistConfig> GetSnapshot() const;
44
45 storages::secdist::Secdist& GetStorage();
46
47 static yaml_config::Schema GetStaticConfigSchema();
48
49private:
50 storages::secdist::Secdist secdist_;
51};
52
53template <>
54inline constexpr bool kHasValidate<Secdist> = true;
55
56template <>
57inline constexpr auto kConfigFileMode<Secdist> = ConfigFileMode::kNotRequired;
58
59} // namespace components
60
61USERVER_NAMESPACE_END