Skip to content

Commit

Permalink
#863 passing networkName to acdc middleware
Browse files Browse the repository at this point in the history
  • Loading branch information
skutner committed Aug 5, 2022
1 parent 9dce0c6 commit 485883c
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 12 deletions.
26 changes: 16 additions & 10 deletions reporting-service/ReportingService.js
Original file line number Diff line number Diff line change
Expand Up @@ -263,18 +263,24 @@ class ReportingService {
console.log(result);
}

this._bindUserDetails(evt, (err, boundEvt) => {
self.settingsService.readSetting(SETTINGS.networkName, (err, networkName) => {
if (err)
return callback(`Could not bind user details`);
self.http.doPost(API_HUB_ENDPOINT, JSON.stringify(boundEvt), HEADERS, (err, result) => {
return callback(err);

evt.networkName = networkName;
this._bindUserDetails(evt, (err, boundEvt) => {
if (err)
return callback(err);
try{
result = JSON.parse(result);
} catch (e) {
return callback(e);
}
callback(undefined, result);
return callback(`Could not bind user details`);
self.http.doPost(API_HUB_ENDPOINT, JSON.stringify(boundEvt), HEADERS, (err, result) => {
if (err)
return callback(err);
try{
result = JSON.parse(result);
} catch (e) {
return callback(e);
}
callback(undefined, result);
});
});
});
});
Expand Down
3 changes: 2 additions & 1 deletion reporting-service/constants.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,8 @@ const HEADERS = {
const SETTINGS = {
enableAcdc: 'acdc-enabled',
didKey: 'acdc-did',
locationKey: 'acdc-location'
locationKey: 'acdc-location',
networkName: "networkName"
}

/**
Expand Down
2 changes: 1 addition & 1 deletion reporting-service/middleware/acdc-middleware.js
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ function startACDCMiddleware(server){
const resolver = opendsu.loadApi('resolver');
const keyssi = opendsu.loadApi('keyssi');

const productSSI = keyssi.createArraySSI('epi', [event.productCode]);
const productSSI = keyssi.createArraySSI(event.networkName, [event.productCode]);

resolver.loadDSU(productSSI, async (err, dsu) => {
if (err)
Expand Down

0 comments on commit 485883c

Please # to comment.