@@ -30,12 +30,12 @@ constexpr std::array<uint8_t, sizeof(uint64_t)> capabilities_byte_array(
3030 return res;
3131}
3232
33- struct ConfigKeyData {
33+ struct ConfigKeyMetadata final {
3434 product::Flag product;
3535 StringView config_id;
3636};
3737
38- Optional<ConfigKeyData > parse_config_path (StringView config_path) {
38+ Optional<ConfigKeyMetadata > parse_config_path (StringView config_path) {
3939 static const std::regex path_reg (
4040 " ^(datadog/\\ d+|employee)/([^/]+)/([^/]+)/[^/]+$" );
4141
@@ -206,16 +206,16 @@ void Manager::process_response(const nlohmann::json& json) {
206206 auto config_path = client_config.get <StringView>();
207207 visited_config.emplace (config_path);
208208
209- const auto config_key_data = parse_config_path (config_path);
210- if (!config_key_data ) {
209+ const auto config_key_metadata = parse_config_path (config_path);
210+ if (!config_key_metadata ) {
211211 std::string reason{config_path};
212212 reason += " is an invalid configuration path" ;
213213
214214 error (reason);
215215 return ;
216216 }
217217
218- const auto product = config_key_data ->product ;
218+ const auto product = config_key_metadata ->product ;
219219
220220 const auto & config_metadata =
221221 targets.at (" /signed/targets" _json_pointer).at (config_path);
@@ -244,30 +244,13 @@ void Manager::process_response(const nlohmann::json& json) {
244244 auto decoded_config = base64_decode (raw_data);
245245
246246 Configuration new_config;
247- auto && config_id = config_key_data->config_id ;
248- new_config.id = std::string{config_id.data (), config_id.size ()};
247+ new_config.id = std::string{config_key_metadata->config_id };
249248 new_config.path = std::string{config_path};
250249 new_config.hash = config_metadata.at (" /hashes/sha256" _json_pointer);
251250 new_config.content = std::move (decoded_config);
252251 new_config.version = config_metadata.at (" /custom/v" _json_pointer);
253252 new_config.product = product;
254253
255- // TODO: should be moved to the listener
256- if (product == product::Flag::APM_TRACING) {
257- const auto config_json = nlohmann::json::parse (new_config.content );
258- new_config.version = config_json.at (" revision" );
259-
260- const auto & targeted_service = config_json.at (" service_target" );
261- if (targeted_service.at (" service" ).get <StringView>() !=
262- tracer_signature_.default_service ||
263- targeted_service.at (" env" ).get <StringView>() !=
264- tracer_signature_.default_environment ) {
265- new_config.state = Configuration::State::error;
266- new_config.error_message = " Wrong service targeted" ;
267- goto skip_listeners;
268- }
269- }
270-
271254 for (const auto & listener : listeners_per_product_[product]) {
272255 // Q: Two listeners on the same product. What should be the behaviour
273256 // if one of the listeners report an error?
@@ -281,7 +264,6 @@ void Manager::process_response(const nlohmann::json& json) {
281264 }
282265 }
283266
284- skip_listeners:
285267 applied_config_[std::string{config_path}] = new_config;
286268 }
287269
0 commit comments