UNPKG

cs-mpx-dataservice

Version:

MPX Dataservices

28 lines (23 loc) 775 B
/** * Created by paul.rangel on 4/29/15. */ var R = require('ramda'); module.exports = function(registry, endpoints ) { var missingRegistryEntries = []; endpoints = R.mapObj(function(endpoint) { var serviceUrl = R.prop(endpoint.service)(registry); if(serviceUrl) { endpoint.baseUrl = serviceUrl; endpoint.url = serviceUrl + endpoint.suffix; endpoint.notifyUrl = serviceUrl + '/notify'; } else { missingRegistryEntries.push(endpoint); } return endpoint; }, endpoints); if (missingRegistryEntries.length > 0) { console.log('Missing registry entries for ', JSON.stringify(missingRegistryEntries, null, 2)); return null; } return endpoints; };