From fb0a7319183a7af40b8893bed702c349943b267b Mon Sep 17 00:00:00 2001 From: Nick O'Leary Date: Tue, 4 Sep 2018 23:10:28 +0100 Subject: [PATCH] Updated Design: Subflow Instance properties (markdown) --- Design:-Subflow-Instance-properties.md | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/Design:-Subflow-Instance-properties.md b/Design:-Subflow-Instance-properties.md index 1d71c03..7a68b9b 100644 --- a/Design:-Subflow-Instance-properties.md +++ b/Design:-Subflow-Instance-properties.md @@ -10,4 +10,15 @@ This design needs to cover: - how the nodes within the subflow can use the customised properties - how an subflow instance node provides custom values to those properities -This will also feed into [[Design: Subflow Node modules]]. \ No newline at end of file +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. \ No newline at end of file