node-red: MQTT in cannot import password from environment variables
What are the steps to reproduce?
Cannot import the password to connect to the MQTT broker getting it from environment variables
What happens?
The environment variable is not solved, it seems that using the syntax $(ENV_VAR)
or ${ENV_VAR}
in the “password” field is not supported
What do you expect to happen?
I expect that the environment variable is substituted runtime
Please tell us about your environment:
- Node-RED version: v1.0.5
- Node.js version: v8.10.0
- npm version: v3.5.2
- Platform/OS: Ubuntu 16.04
- Browser: Chrome
About this issue
- Original URL
- State: closed
- Created 4 years ago
- Comments: 22 (11 by maintainers)
OK, so the problem here is that your credentials file will still be being stored in the
userDir
which is/data
in the container. You are not mounting this as a volume so it will not be persisted across a container restart. So your creds file will be lost, hence not being able to reconnect to the MQTT broker.I suggest you don’t bother with the
/usr/src/node-red/data
or/usr/src/node-red/save_files
at all and just put everything in/data
and make sure that is mounted as volume.You also will not need the
user:root
.We would have got here a lot quicker if you had fully described what you were doing at the start.