|
12 | 12 |
|
13 | 13 | #include <storages/mongo/mongo_secdist.hpp> |
14 | 14 |
|
| 15 | +#ifndef ARCADIA_ROOT |
| 16 | +#include "generated/src/storages/mongo/component.yaml.hpp" // Y_IGNORE |
| 17 | +#include "generated/src/storages/mongo/component_multi.yaml.hpp" // Y_IGNORE |
| 18 | +#endif |
| 19 | + |
15 | 20 | USERVER_NAMESPACE_BEGIN |
16 | 21 |
|
17 | 22 | namespace components { |
@@ -85,22 +90,7 @@ void Mongo::OnSecdistUpdate(const storages::secdist::SecdistConfig& config) { |
85 | 90 | } |
86 | 91 |
|
87 | 92 | yaml_config::Schema Mongo::GetStaticConfigSchema() { |
88 | | - return yaml_config::MergeSchemas<MultiMongo>(R"( |
89 | | -type: object |
90 | | -description: MongoDB client component |
91 | | -additionalProperties: false |
92 | | -properties: |
93 | | - dbalias: |
94 | | - type: string |
95 | | - description: name of the database in secdist config (if available) |
96 | | - dbconnection: |
97 | | - type: string |
98 | | - description: connection string (used if no dbalias specified) |
99 | | - maintenance_period: |
100 | | - type: string |
101 | | - description: pool maintenance period (idle connections pruning etc.) |
102 | | - defaultDescription: 15s |
103 | | -)"); |
| 93 | + return yaml_config::MergeSchemasFromResource<MultiMongo>("src/storages/mongo/component.yaml"); |
104 | 94 | } |
105 | 95 |
|
106 | 96 | MultiMongo::MultiMongo(const ComponentConfig& config, const ComponentContext& context) |
@@ -132,79 +122,7 @@ bool MultiMongo::RemovePool(const std::string& dbalias) { return multi_mongo_.Re |
132 | 122 | storages::mongo::MultiMongo::PoolSet MultiMongo::NewPoolSet() { return multi_mongo_.NewPoolSet(); } |
133 | 123 |
|
134 | 124 | yaml_config::Schema MultiMongo::GetStaticConfigSchema() { |
135 | | - return yaml_config::MergeSchemas<ComponentBase>(R"( |
136 | | -type: object |
137 | | -description: Dynamically configurable MongoDB client component |
138 | | -additionalProperties: false |
139 | | -properties: |
140 | | - appname: |
141 | | - type: string |
142 | | - description: application name for the DB server |
143 | | - defaultDescription: userver |
144 | | - conn_timeout: |
145 | | - type: string |
146 | | - description: connection timeout |
147 | | - defaultDescription: 2s |
148 | | - so_timeout: |
149 | | - type: string |
150 | | - description: socket timeout |
151 | | - defaultDescription: 10s |
152 | | - queue_timeout: |
153 | | - type: string |
154 | | - description: max connection queue wait time |
155 | | - defaultDescription: 1s |
156 | | - initial_size: |
157 | | - type: string |
158 | | - description: number of connections created initially (per database) |
159 | | - defaultDescription: 16 |
160 | | - max_size: |
161 | | - type: integer |
162 | | - description: limit for total connections number (per database) |
163 | | - defaultDescription: 128 |
164 | | - idle_limit: |
165 | | - type: integer |
166 | | - description: limit for idle connections number (per database) |
167 | | - defaultDescription: 64 |
168 | | - connecting_limit: |
169 | | - type: integer |
170 | | - description: limit for establishing connections number (per database) |
171 | | - defaultDescription: 8 |
172 | | - local_threshold: |
173 | | - type: string |
174 | | - description: latency window for instance selection |
175 | | - defaultDescription: mongodb default |
176 | | - max_replication_lag: |
177 | | - type: string |
178 | | - description: replication lag limit for usable secondaries, min. 90s |
179 | | - stats_verbosity: |
180 | | - type: string |
181 | | - description: changes the granularity of reported metrics |
182 | | - defaultDescription: 'terse' |
183 | | - enum: |
184 | | - - terse |
185 | | - - full |
186 | | - - none |
187 | | - dns_resolver: |
188 | | - type: string |
189 | | - description: server hostname resolver type (getaddrinfo or async) |
190 | | - defaultDescription: 'async' |
191 | | - enum: |
192 | | - - getaddrinfo |
193 | | - - async |
194 | | - congestion_control: |
195 | | - description: congestion control settings |
196 | | - type: object |
197 | | - additionalProperties: false |
198 | | - properties: |
199 | | - fake-mode: |
200 | | - type: boolean |
201 | | - description: whether CC limiter is actually working |
202 | | - defaultDescription: false |
203 | | - enabled: |
204 | | - type: boolean |
205 | | - description: whether CC is enabled for the database |
206 | | - defaultDescription: true |
207 | | -)"); |
| 125 | + return yaml_config::MergeSchemasFromResource<ComponentBase>("src/storages/mongo/component_multi.yaml"); |
208 | 126 | } |
209 | 127 |
|
210 | 128 | } // namespace components |
|
0 commit comments