Using environment variable as password for "MQTT in" node

Hi all,
I'm trying to use an environment variable for connect to a MQTT broker (node "MQTT in") without entering the credential each time I start my node-red server.

I tried both $(ENV_VAR) and ${ENV_VAR} syntaxes, but it seems like if the environment variable is not resolved and the node applies the exact chars entered in the form field as password.

Do you know a solution to this problem?

Thank you
Walter

A search of the forum shows this...

Are you saying it works OK if the env var IS created (but uses the $(xxx) if its not defined)?

In which case - is that a problem?

I would suggest creating a flow with an inject node configured to send the env var you are trying to use. pass that to a debug node so you can verify the env var is actually set within the Node-RED environment.

"MQTT in" node is initialized before the flow starts, so I cannot inject a variable acquired while the flow is running.

I verified that the variable exists because so set it manually in "MQTT in" I use a sub-flow to read it from debug

It works for every form field (for example I can correctly get the IP address and the port of the MQTT broker from env variables), but not for the password field.

It's like if the char '$', '(' and '{' are used as password charts instead of been replaced

This topic was automatically closed 60 days after the last reply. New replies are no longer allowed.