[Proposal] Make node name accessible as environment variable

As we can see in the following posts, I think it makes sense to be able to refer to the node name because each node has a name attribute and many nodes have meaningful names on the flow.

So, I would like to propose the following extension to environment variable.

Proposal

  • References to _NODE_NAME_ environment variable are replaced with the value of the node's name property.

I wonder if there is a set of standard properties that could be exposed in this way.

  • name
  • id
  • path

The only bit I'm less sure on is the format of the env var. We tend to prefix properties with _ if they are more internal and not necessarily meant for general use.

I would suggest NODE_NAME NODE_ID and NODE_PATH ?

Having written that out, NODE_PATH is a well-known environment variable already - not that I'd expect a NR flow to ever want to make use of it. But it could cause confusion.

1 Like

id is an additional candidate as environment variable.
I used _ as prefix because I was afraid of collision with the existing variable name, but it is okay to omit _ according to the policy.

Regarding path, as it is still in the design discussion stage, I think it is better to discuss it together with that design. From the NODE_PATH environment variable you pointed out, I come to a little concerns that the name path may be mistaken as the directory path where the node is installed.

Good point about the path name.

As you know (but for other readers' benefit) it is the name of an internal property used to identify exactly where a node exists in a flow (such as inside nested subflows). And we have a separate discussion over exposing that more formally as a node property.