Skip to content

Commit 90f7268

Browse files
authored
Merge pull request #264 from node-red-hitachi/update-env-var
Add description of new environment variable features
2 parents c890cfe + 3b8c53f commit 90f7268

File tree

1 file changed

+26
-0
lines changed

1 file changed

+26
-0
lines changed

docs/user-guide/environment-variables.md

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -89,3 +89,29 @@ For example, given a REST API that provides access to different types of record,
8989
a subflow could be created to access the API and handle the response, using an
9090
environment variable to identify which type of record should be accessed. Individual
9191
instances of the Subflow can then be customised for those particular types.
92+
93+
### Flow/Group level environment variable
94+
95+
Since 2.21, environment variables can be set for Flow or Group on their settings panel.
96+
97+
### Predefined environment variable
98+
99+
Since 2.22, following predefined environment variables has been added that provides access to information about the node, group and flow.
100+
101+
- `NR_NODE_ID` - the ID of the node
102+
- `NR_NODE_NAME` - the Name of the node
103+
- `NR_NODE_NAME` - the Path of the node
104+
105+
The node's path represents a node's hierarchy in a flow. It is `/`
106+
delimited IDs of the flow, enclosing subflows, and the node.
107+
- `NR_GROUP_ID` - the ID of the containing group
108+
- `NR_GROUP_NAME` - the Name of the containing group
109+
- `NR_FLOW_ID` - the ID of the flow the node is on
110+
- `NR_FLOW_NAME` - the Name of the flow the node is on
111+
112+
### Accessing nested environment variable
113+
114+
Environment variable definition is searched from the bottom to the top
115+
of the node's definition hierarchy. `$ parent.` prefix can be added to
116+
environment variable name (e.g. `$parent.NR_GROUP_NAME`) to move the
117+
start position of this search up one level in the hierarchy.

0 commit comments

Comments
 (0)