Merge pull request #4250 from node-red/4239-add-nr-subflow-name-env

Add NR_SUBFLOW_NAME/ID/PATH env vars
This commit is contained in:
Stephen McLaughlin 2023-07-14 17:24:14 +01:00 committed by GitHub
commit d5baa402c8
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 3 additions and 3 deletions

View File

@ -341,13 +341,13 @@ class Subflow extends Flow {
getSetting(key) {
const node = this.subflowInstance;
if (node) {
if (key === "NR_NODE_NAME") {
if (key === "NR_NODE_NAME" || key === "NR_SUBFLOW_NAME") {
return node.name;
}
if (key === "NR_NODE_ID") {
if (key === "NR_NODE_ID" || key === "NR_SUBFLOW_ID") {
return node.id;
}
if (key === "NR_NODE_PATH") {
if (key === "NR_NODE_PATH" || key === "NR_SUBFLOW_PATH") {
return node._path;
}
}