mirror of
https://github.com/node-red/node-red.git
synced 2023-10-10 13:36:53 +02:00
Tidy up flow/util
This commit is contained in:
parent
f196493402
commit
3209777aba
@ -13,16 +13,22 @@
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
**/
|
||||
var clone = require("clone");
|
||||
var redUtil = require("@node-red/util").util;
|
||||
var Log = require("@node-red/util").log;
|
||||
var subflowInstanceRE = /^subflow:(.+)$/;
|
||||
var typeRegistry = require("@node-red/registry");
|
||||
const credentials = require("../nodes/credentials");
|
||||
const clone = require("clone");
|
||||
const redUtil = require("@node-red/util").util;
|
||||
const Log = require("@node-red/util").log;
|
||||
const typeRegistry = require("@node-red/registry");
|
||||
const subflowInstanceRE = /^subflow:(.+)$/;
|
||||
|
||||
let _runtime = null;
|
||||
let envVarExcludes = {};
|
||||
|
||||
var envVarExcludes = {};
|
||||
function init(runtime) {
|
||||
_runtime = runtime;
|
||||
envVarExcludes = {};
|
||||
if (runtime.settings.hasOwnProperty('envVarExcludes') && Array.isArray(runtime.settings.envVarExcludes)) {
|
||||
runtime.settings.envVarExcludes.forEach(v => envVarExcludes[v] = true);
|
||||
}
|
||||
}
|
||||
|
||||
function diffNodes(oldNode,newNode) {
|
||||
if (oldNode == null) {
|
||||
@ -121,6 +127,12 @@ async function evaluateEnvProperties(flow, env, credentials) {
|
||||
return evaluatedEnv
|
||||
}
|
||||
|
||||
/**
|
||||
* Create a new instance of a node
|
||||
* @param {Flow} flow The containing flow
|
||||
* @param {object} config The node configuration object
|
||||
* @return {Node} The instance of the node
|
||||
*/
|
||||
async function createNode(flow,config) {
|
||||
var newNode = null;
|
||||
var type = config.type;
|
||||
@ -317,28 +329,13 @@ function parseConfig(config) {
|
||||
});
|
||||
return flow;
|
||||
}
|
||||
|
||||
module.exports = {
|
||||
init: function(runtime) {
|
||||
_runtime = runtime;
|
||||
envVarExcludes = {};
|
||||
if (runtime.settings.hasOwnProperty('envVarExcludes') && Array.isArray(runtime.settings.envVarExcludes)) {
|
||||
runtime.settings.envVarExcludes.forEach(v => envVarExcludes[v] = true);
|
||||
}
|
||||
},
|
||||
getEnvVar: function(k) {
|
||||
function getEnvVar(k) {
|
||||
if (!envVarExcludes[k]) {
|
||||
return process.env[k];
|
||||
}
|
||||
return undefined;
|
||||
},
|
||||
|
||||
diffNodes,
|
||||
mapEnvVarProperties,
|
||||
evaluateEnvProperties,
|
||||
parseConfig,
|
||||
|
||||
diffConfigs: function(oldConfig, newConfig) {
|
||||
}
|
||||
function diffConfigs(oldConfig, newConfig) {
|
||||
var id;
|
||||
var node;
|
||||
var nn;
|
||||
@ -621,14 +618,15 @@ module.exports = {
|
||||
// }
|
||||
|
||||
return diff;
|
||||
},
|
||||
}
|
||||
|
||||
/**
|
||||
* Create a new instance of a node
|
||||
* @param {Flow} flow The containing flow
|
||||
* @param {object} config The node configuration object
|
||||
* @return {Node} The instance of the node
|
||||
*/
|
||||
createNode: createNode,
|
||||
module.exports = {
|
||||
init,
|
||||
createNode,
|
||||
parseConfig,
|
||||
diffConfigs,
|
||||
diffNodes,
|
||||
getEnvVar,
|
||||
mapEnvVarProperties,
|
||||
evaluateEnvProperties
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user