mirror of
https://github.com/node-red/node-red.git
synced 2025-03-01 10:36:34 +00:00
add JSONata support for env var definition
This commit is contained in:
12
packages/node_modules/@node-red/util/lib/util.js
vendored
12
packages/node_modules/@node-red/util/lib/util.js
vendored
@@ -696,13 +696,19 @@ function evaluateNodeProperty(value, type, node, msg, callback) {
|
||||
function prepareJSONataExpression(value,node) {
|
||||
var expr = jsonata(value);
|
||||
expr.assign('flowContext', function(val, store) {
|
||||
return node.context().flow.get(val, store);
|
||||
if (node) {
|
||||
return node.context().flow.get(val, store);
|
||||
}
|
||||
return "";
|
||||
});
|
||||
expr.assign('globalContext', function(val, store) {
|
||||
return node.context().global.get(val, store);
|
||||
if (node) {
|
||||
return node.context().global.get(val, store);
|
||||
}
|
||||
return "";
|
||||
});
|
||||
expr.assign('env', function(name) {
|
||||
var val = getSetting(node, name, node._flow);
|
||||
var val = getSetting(node, name, node ? node._flow : null);
|
||||
if (typeof val !== 'undefined') {
|
||||
return val;
|
||||
} else {
|
||||
|
Reference in New Issue
Block a user