jd76
jd76

Reputation: 117

How to get User-Defined variables in node-red app in Bluemix

In my node-red app in Bluemix, I added a User-Defined environment variable. Not sure how to get that variable from a function in my node-red application. Thanks.

Upvotes: 1

Views: 1788

Answers (2)

user7071394
user7071394

Reputation: 1

To get User Defined Variable from Bluemix you must use something like this:

var services = context.global.process.env['USR_DEFINED_VAR'];

after configuring functionGlobalContext: { process: process } in bluemix-settings.js

To change the value is just like that:

context.global.process.env['USR_DEFINED_VAR'] = value;

Upvotes: 0

alexandrakayy
alexandrakayy

Reputation: 91

You will need to edit the bluemix-settings.js file to include the "process" built-n or other variables in functionGlobalContext.

functionGlobalContext: { process: process }

Once redeployed you can access the process in a function node as...

context.global.process

https://developer.ibm.com/answers/questions/170246/how-do-i-get-at-my-vcap-variables-from-node-red.html

Upvotes: 1

Related Questions