Skip to content

Commit

Permalink
Merge pull request #445 from telefonicaid/fix/check_ngsi_version_resp…
Browse files Browse the repository at this point in the history
…onse_configuration

check ngsi version before read configuration response
  • Loading branch information
fgalan authored Oct 20, 2020
2 parents df0dbfd + aa36d85 commit ce8fd0e
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
1 change: 1 addition & 0 deletions CHANGES_NEXT_RELEASE
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
FIX: check ngsi version in configuration handler
Add missed global config env vars (IOTA_CONFIG_RETRIEVAL, IOTA_DEFAULT_KEY, IOTA_DEFAULT_TRANSPORT)
Update Docker security practices (Add HEALTHCHECK, Use Anonymous User, Use two-stage build)
6 changes: 4 additions & 2 deletions lib/iotaUtils.js
Original file line number Diff line number Diff line change
Expand Up @@ -266,14 +266,16 @@ function manageConfiguration(apiKey, deviceId, device, objMessage, sendFunction,
}

function extractAttributes(results, callback) {
if (
if (iotAgentLib.configModule.checkNgsi2()) {
callback(null, results);
} else if (
results.contextResponses &&
results.contextResponses[0] &&
results.contextResponses[0].contextElement.attributes
) {
callback(null, results.contextResponses[0].contextElement.attributes);
} else {
callback("Couldn't find any information in Context Broker response");
callback("Couldn't find any information in Context Broker response: " + JSON.stringify(results));
}
}

Expand Down

0 comments on commit ce8fd0e

Please sign in to comment.