Skip to content

Commit 0fdbf47

Browse files
committed
docs
1 parent 4658b83 commit 0fdbf47

File tree

5 files changed

+32
-29
lines changed

5 files changed

+32
-29
lines changed

core/include/userver/storages/secdist/component.hpp

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -14,21 +14,17 @@ namespace components {
1414

1515
/// @ingroup userver_components
1616
///
17-
/// @brief Component that stores security related data (keys, passwords, ...).
17+
/// @brief Default implementation of components::SecdistComponentBase.
1818
///
1919
/// The component must be configured in service config.
2020
///
21-
/// Secdist requires a provider storages::secdist::SecdistProvider
22-
/// You can implement your own or use components::DefaultSecdistProvider
23-
///
2421
/// ## Static configuration example:
2522
///
2623
/// @snippet samples/redis_service/static_config.yaml Sample secdist static config
2724
///
2825
/// ## Static options:
2926
/// Name | Description | Default value
3027
/// ---- | ----------- | -------------
31-
/// provider | optional secdist provider component name | 'default-secdist-provider'
3228
/// config | path to the config file with data | ''
3329
/// format | config format, either `json` or `yaml` | 'json'
3430
/// missing-ok | do not terminate components load if no file found by the config option | false
@@ -48,7 +44,7 @@ class Secdist final : public SecdistComponentBase {
4844

4945
static yaml_config::Schema GetStaticConfigSchema();
5046
};
51-
47+
/// [Sample secdist - default secdist]
5248
template <>
5349
inline constexpr bool kHasValidate<Secdist> = true;
5450

core/include/userver/storages/secdist/component_base.hpp

Lines changed: 8 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -15,28 +15,18 @@ namespace components {
1515

1616
/// @ingroup userver_components
1717
///
18-
/// @brief Component that stores security related data (keys, passwords, ...).
18+
/// @brief Base component that stores security related data (keys, passwords, ...).
1919
///
20-
/// The component must be configured in service config.
20+
/// You can use a ready-made components::Secdist or implement your own.
2121
///
22-
/// Secdist requires a provider storages::secdist::SecdistProvider
23-
/// You can implement your own or use components::DefaultSecdistProvider
22+
/// ### Writing your own secrets distributor:
23+
/// Implement a custom provider class that contains the settings.
24+
/// @snippet core/include/userver/storages/secdist/default_provider.hpp Sample secdist - default provider
2425
///
25-
/// ## Static configuration example:
26+
/// Implement a custom secdist component, configure it's static config schema
27+
/// and pass the custom provider to the storages::secdist::SecdistConfig::Settings.
28+
/// @snippet core/include/userver/storages/secdist/component.сpp Sample secdist - default secdist
2629
///
27-
/// @snippet samples/redis_service/static_config.yaml Sample secdist static config
28-
///
29-
/// ## Static options:
30-
/// Name | Description | Default value
31-
/// ---- | ----------- | -------------
32-
/// provider | optional secdist provider component name | 'default-secdist-provider'
33-
/// config | path to the config file with data | ''
34-
/// format | config format, either `json` or `yaml` | 'json'
35-
/// missing-ok | do not terminate components load if no file found by the config option | false
36-
/// environment-secrets-key | name of environment variable from which to load additional data | -
37-
/// update-period | period between data updates in utils::StringToDuration() suitable format ('0s' for no updates) | 0s
38-
/// blocking-task-processor | name of task processor for background blocking operations | --
39-
4030
// clang-format on
4131

4232
class SecdistComponentBase : public LoggableComponentBase {

core/include/userver/storages/secdist/default_provider.hpp

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
#pragma once
22

3-
/// @file userver/storages/secdist/component.hpp
4-
/// @brief @copybrief components::DefaultSecdistProvider
3+
/// @file userver/storages/secdist/default_provider.hpp
4+
/// @brief @copybrief storages::secdist::DefaultProvider
55

66
#include <string>
77

@@ -11,7 +11,15 @@
1111
USERVER_NAMESPACE_BEGIN
1212

1313
namespace storages::secdist {
14+
// clang-format off
1415

16+
/// @brief Default implementation of storages::secdist::SecdistProvider.
17+
///
18+
/// Provides components::Secdist configurations to the
19+
/// storages::secdist::SecdistConfig
20+
21+
// clang-format on
22+
/// [Sample secdist - default provider]
1523
class DefaultProvider final : public storages::secdist::SecdistProvider {
1624
public:
1725
struct Settings {
@@ -29,7 +37,7 @@ class DefaultProvider final : public storages::secdist::SecdistProvider {
2937
private:
3038
Settings settings_;
3139
};
32-
40+
/// [Sample secdist - default provider]
3341
} // namespace storages::secdist
3442

3543
USERVER_NAMESPACE_END

core/include/userver/storages/secdist/provider.hpp

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,15 @@ namespace storages::secdist {
1010

1111
class SecdistProvider {
1212
public:
13+
SecdistProvider() = default;
14+
virtual ~SecdistProvider() = default;
15+
16+
SecdistProvider(const SecdistProvider&) = delete;
17+
SecdistProvider& operator=(const SecdistProvider&) = delete;
18+
19+
SecdistProvider(SecdistProvider&&) = default;
20+
SecdistProvider& operator=(SecdistProvider&&) = default;
21+
1322
virtual formats::json::Value Get() const = 0;
1423
};
1524

core/src/storages/secdist/component.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
#include <userver/yaml_config/merge_schemas.hpp>
99

1010
USERVER_NAMESPACE_BEGIN
11-
11+
/// [Sample secdist - default secdist]
1212
namespace components {
1313
namespace {
1414

@@ -87,5 +87,5 @@ additionalProperties: false
8787
}
8888

8989
} // namespace components
90-
90+
/// [Sample secdist - default secdist]
9191
USERVER_NAMESPACE_END

0 commit comments

Comments
 (0)