Home > Blockchain >  How to set environment variables containing "!" in Heroku?
How to set environment variables containing "!" in Heroku?

Time:01-29

I've been stuck on this for ages and I can't find a solution. I've set up environment variables in the ~/.zshrc file and exported them correctly.

Now when I try these commands for heroku setup it works for the email address but when I enter it for the password it removes the ! at the end of my password.

input:

heroku config:set EMAIL_HOST_USER="[email protected]"
heroku config:set EMAIL_HOST_PASSWORD="mypassword!"

output:

Setting EMAIL_HOST_PASSWORD and restarting ⬢ <app-name>... done, v45
EMAIL_HOST_PASSWORD: mypassword

Can anyone explain why this may be happening?

I have also tried,

heroku config:add

but the exclamation mark is also removed.

CodePudding user response:

I discovered you can edit your Heroku config variables in your settings of your project. https://dashboard.heroku.com/

I would still like to know how come the '!' would not save if anyone stumbles across this post and knows the answer :)

CodePudding user response:

Many shells, including zsh and bash, interpret exclamation points as history expansion characters.

In both of those shells you should be able to single quote (') the value to get it to work:

heroku config:set EMAIL_HOST_PASSWORD='mypassword!'

Double quotes (") won't work.

As noted in that mailing list post, if you want to completely disable this feature in zsh you can do so with

unsetopt banghistory

And in bash you can do

set  H

or

set  histexpand
  •  Tags:  
  • Related