1
0
mirror of https://github.com/node-red/node-red.git synced 2023-10-10 13:36:53 +02:00

Updated Design: Subflow Instance properties (markdown)

Nick O'Leary 2018-09-04 23:10:28 +01:00
parent 4ff506d784
commit fb0a731918

@ -10,4 +10,15 @@ This design needs to cover:
- how the nodes within the subflow can use the customised properties - how the nodes within the subflow can use the customised properties
- how an subflow instance node provides custom values to those properities - how an subflow instance node provides custom values to those properities
This will also feed into [[Design: Subflow Node modules]]. This will also feed into [[Design: Subflow Node modules]].
---
*Following a [post on the forum](https://discourse.nodered.org/t/pr-subflow-instance-properties/2853) here's a copy of my response there. These points need expanding out in the design.*
- Subflow instance properties are evaluated when the instance is created in the runtime. They **cannot** be set by passed in messages. They **cannot** change without the subflow instance being redeployed. This is because they are used to configure nodes within the subflow - and nodes cannot have their configuration dynamically changed at runtime. For example, the address of the MQTT Broker to connect to.
- This means the instance properties can only be set by any of the *static* types in the TypedInput list of supported types - including environment variables. That excludes `msg`, `flow` and `global`.
- Subflow instance properties appear as environment variables to the nodes within the subflow. This means, as you can today, a node's property can be set to the value `${FOO}` for it to be substituted with the value of `FOO`.
- We have already added in git (#dev branch) the ability to get env var values in a Function node - using `env.get("FOO")`. That will allow Function nodes to programmatically access subflow instance properties.
- A Change node (using the Env Var TypedInput type) can be used to attach any of these properties to a `msg` object passing through the flow if that is required.