userver
C++ Async Framework
Loading...
Searching...
No Matches
provider_component.hpp
1
#
pragma
once
2
3
/// @file userver/storages/secdist/component.hpp
4
/// @brief @copybrief components::DefaultSecdistProvider
5
6
#
include
<
string
>
7
8
#
include
<
userver
/
components
/
component_base
.
hpp
>
9
#
include
<
userver
/
storages
/
secdist
/
provider
.
hpp
>
10
#
include
<
userver
/
storages
/
secdist
/
secdist
.
hpp
>
11
12
USERVER_NAMESPACE_BEGIN
13
14
namespace
storages::
secdist
{
15
16
class
DefaultLoader
final
:
public
storages::
secdist
::
SecdistProvider
{
17
public
:
18
struct
Settings
{
19
std::string config_path;
20
SecdistFormat
format{
SecdistFormat
::kJson};
21
bool
missing_ok{
false
};
22
std::optional<std::string> environment_secrets_key;
23
engine::TaskProcessor* blocking_task_processor{
nullptr
};
24
formats
::
json
::Value inline_config;
25
};
26
27
explicit
DefaultLoader(
Settings
settings);
28
29
formats
::
json
::Value Get()
const
override
;
30
31
private
:
32
Settings
settings_;
33
};
34
35
}
// namespace storages::secdist
36
37
namespace
components
{
38
// clang-format off
39
40
/// @ingroup userver_components
41
///
42
/// @brief Component that stores security related data (keys, passwords, ...).
43
///
44
/// The component must be configured in service config.
45
///
46
/// ## Static options:
47
/// Name | Description | Default value
48
/// ---- | ----------- | -------------
49
/// config | path to the config file with data | ''
50
/// inline | inline data | -
51
/// format | config format, one of `json`, `yaml`, `yaml_config` | 'json'
52
/// missing-ok | do not terminate components load if no file found by the config option | false
53
/// environment-secrets-key | name of environment variable from which to load additional data | -
54
/// blocking-task-processor | name of task processor for background blocking operations | --
55
56
// clang-format on
57
58
class
DefaultSecdistProvider
final
:
public
ComponentBase,
public
storages::
secdist
::
SecdistProvider
{
59
public
:
60
/// @ingroup userver_component_names
61
/// @brief The default name of components::DefaultSecdistProvider
62
static
constexpr
std
::
string_view
kName
=
"default-secdist-provider"
;
63
64
DefaultSecdistProvider(
const
ComponentConfig&,
const
ComponentContext&);
65
66
formats
::
json
::Value Get()
const
override
;
67
68
static
yaml_config
::Schema GetStaticConfigSchema();
69
70
private
:
71
storages::
secdist
::DefaultLoader loader_;
72
};
73
74
template
<>
75
inline
constexpr
bool
kHasValidate
<
DefaultSecdistProvider
> =
true
;
76
77
}
// namespace components
78
79
USERVER_NAMESPACE_END
userver
storages
secdist
provider_component.hpp
Generated on Wed Dec 4 2024 18:42:29 for userver by
Doxygen
1.10.0