Revert "Add callback to getSetting to support async jsonata access"

This commit is contained in:
Nick O'Leary
2023-06-22 10:17:48 +01:00
committed by GitHub
parent 2448e137c8
commit 51a0b68d8e
9 changed files with 90 additions and 287 deletions

View File

@@ -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,