mirror of
https://github.com/node-red/node-red.git
synced 2025-03-01 10:36:34 +00:00
Revert "Add callback to getSetting to support async jsonata access"
This commit is contained in:
@@ -308,34 +308,16 @@ module.exports = {
|
||||
runtime.settings.envVarExcludes.forEach(v => envVarExcludes[v] = true);
|
||||
}
|
||||
},
|
||||
/**
|
||||
* Get the value of an environment variable
|
||||
* Call with a callback to get the value asynchronously
|
||||
* or without to get the value synchronously
|
||||
* @param {String} key The name of the environment variable
|
||||
* @param {(err: Error, val: Any)} [callback] Optional callback for asynchronous call
|
||||
* @returns {Any | void} The value of the environment variable or undefined if not found
|
||||
*/
|
||||
getEnvVar: function(key, callback) {
|
||||
const returnOrCallback = function(err, val) {
|
||||
if (callback) {
|
||||
callback(err, val);
|
||||
return;
|
||||
}
|
||||
return val;
|
||||
}
|
||||
if (!envVarExcludes[key]) {
|
||||
const item = getGlobalEnv(key);
|
||||
getEnvVar: function(k) {
|
||||
if (!envVarExcludes[k]) {
|
||||
const item = getGlobalEnv(k);
|
||||
if (item) {
|
||||
const val = redUtil.evaluateNodeProperty(item.value, item.type, null, null, callback);
|
||||
if (callback) {
|
||||
return;
|
||||
}
|
||||
const val = redUtil.evaluateNodeProperty(item.value, item.type, null, null, null);
|
||||
return val;
|
||||
}
|
||||
return returnOrCallback(null, process.env[key]);
|
||||
return process.env[k];
|
||||
}
|
||||
return returnOrCallback(undefined);
|
||||
return undefined;
|
||||
},
|
||||
diffNodes: diffNodes,
|
||||
mapEnvVarProperties: mapEnvVarProperties,
|
||||
|
||||
Reference in New Issue
Block a user