I am using Node-RED and want to parse in Bluemix VCAP_SERVICES
but I am getting an error. My code is:
var services = context.global.VCAP_SERVICES;
var env_cloudint = services['CloudIntegration'][0].credentials;
but I get this error :
TypeError: Cannot read property 'CloudIntegration' of undefined
I do have CloudIntegration in my VCAP_SERVICES
. Do I need anything extra in my code to exploit VCAP_SERVICES
?
By default, environment variables are not added to the Function global context object. To access the Bluemix VCAP_SERVICES
environment variable from a Node-RED flow, you will need to add it to the Function node's global context.
Edit bluemix-settings.js and add an entry to the functionGlobalContext property:
functionGlobalContext: { VCAP_SERVICES: JSON.parse(process.env.VCAP_SERVICES)}
Then redeploy your app. When redeployed, you can then access VCAP_SERVICES
in a Function node as the context.global.VCAP_SERVICES
variable.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.