mirror of
https://github.com/node-red/node-red.git
synced 2025-03-01 10:36:34 +00:00
Add simple caching of env var lookup
This commit is contained in:
parent
c2710f4f6f
commit
54e6d60fe5
@ -110,6 +110,10 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
function getEnvVars (obj, envVars = {}) {
|
function getEnvVars (obj, envVars = {}) {
|
||||||
|
contextKnownKeys.env = contextKnownKeys.env || {}
|
||||||
|
if (contextKnownKeys.env[obj.id]) {
|
||||||
|
return contextKnownKeys.env[obj.id]
|
||||||
|
}
|
||||||
let parent
|
let parent
|
||||||
if (obj.type === 'tab' || obj.type === 'subflow') {
|
if (obj.type === 'tab' || obj.type === 'subflow') {
|
||||||
RED.nodes.eachConfig(function (conf) {
|
RED.nodes.eachConfig(function (conf) {
|
||||||
@ -130,9 +134,10 @@
|
|||||||
envVars[env.name] = obj
|
envVars[env.name] = obj
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
contextKnownKeys.env[obj.id] = envVars
|
||||||
return envVars
|
return envVars
|
||||||
}
|
}
|
||||||
RED.pp = getEnvVars
|
|
||||||
const envAutoComplete = function (val) {
|
const envAutoComplete = function (val) {
|
||||||
const editStack = RED.editor.getEditStack()
|
const editStack = RED.editor.getEditStack()
|
||||||
if (editStack.length === 0) {
|
if (editStack.length === 0) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user