Using ENV vars to set MQTT server

Hello there,

I'm running Node-RED under Docker. In my flow, I want to subscribe to MQTT topics. The MQTT broker server should be read from the ENV vars:
image

My broker only accepts connections via websocket (like ws://[ip-address]/mqtt). But the mqtt-in-node reads them as a string:

Any ideas on how to fix this?

Try ${MQTT_BROKER}

https://nodered.org/docs/user-guide/environment-variables

This only works if it replaces the entire property - it cannot be used to substitute just part of the value. For example, it is not possible to use CLIENT-${HOST} .

Ah it works! It also seemed like my docker-compose file didn't really create the environment variable which was also causing confusion.

Nevertheless, thank you :slight_smile:

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