mirror of
https://github.com/node-red/node-red.git
synced 2025-03-01 10:36:34 +00:00
add support for accessing node id & name as env var
This commit is contained in:
@@ -522,6 +522,14 @@ function setObjectProperty(msg,prop,value,createMissing) {
|
||||
* @return {String} value of env var
|
||||
*/
|
||||
function getSetting(node, name, flow_) {
|
||||
if (node) {
|
||||
if (name === "NODE_NAME") {
|
||||
return node.name;
|
||||
}
|
||||
if (name === "NODE_ID") {
|
||||
return node.id;
|
||||
}
|
||||
}
|
||||
var flow = (flow_ ? flow_ : (node ? node._flow : null));
|
||||
if (flow) {
|
||||
if (node && node.g) {
|
||||
|
Reference in New Issue
Block a user