I have a Heroku application that needs a URI with an ampersand (&) in it as a config variable. Specifically, it's a MongoDB Atlas connection string, but that's beside the point. According to the Heroku Docs, I should format this CLI command like so:
heroku config:set exampleVar=www.bar.com?a=b&c=d&e=f&justkey
However, when I attempt to actually run that command, I get the following:
Setting exampleVar and restarting ⬢ example-heroku-app... done, v10
exampleVar: www.bar.com?a=b
'c' is not recognized as an internal or external command,
operable program or batch file.
'e' is not recognized as an internal or external command,
operable program or batch file.
'justkey' is not recognized as an internal or external command,
operable program or batch file.
It appears that the & character is causing Heroku to interpret what comes after it as a command? I'm guessing I need to somehow escape it, but I'm at a loss as to how. Converting & into \& has no effect, and neither does adding single or double quotes. If anyone has an answer here, please enlighten me! I can't seem to find decent documentation on Heroku Config's special character rules.