Mqtt password in environment variable #2451
-
Hi! We are facing a problem while trying to move the password that we use to connect to mqtt to an environment variable. We feel that the problem might be caused by the presence of the $ character in the password (the password we are using is Benthos1234!$@) The other parameters (url, user, ecc) are correctly retrieved, so we exclude an issue on that side; we also tried to escape the password parameter (${{MQTT_PASSWORD}}) as suggested in the Interpolation guide Here's part of the configuration file we are using:
|
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 1 reply
-
Hey @alessandro-gomma 👋 I think that might be due to the way the shell is handling environment variables. That sequence of characters is causing trouble for me as well in zsh on OSX, so I'm not sure what needs to be escaped or how, but it should work if you create a PS: Converting this into a discussion as per #2026. |
Beta Was this translation helpful? Give feedback.
Hey @alessandro-gomma 👋 I think that might be due to the way the shell is handling environment variables. That sequence of characters is causing trouble for me as well in zsh on OSX, so I'm not sure what needs to be escaped or how, but it should work if you create a
foo.env
file (you can call it whatever you want) containingMQTT_PASSWORD="Benthos1234!$@"
(the double quotes are optional if you don't have spaces in the password) and then runbenthos -e foo.env -c test.yaml
.PS: Converting this into a discussion as per #2026.