Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Heroku config:push not updating environment variables

I've deployed an app to Heroku, and I'm currently storing my environment variables in an .env file. I used heroku config:push to push the variables up to heroku, and that worked fine.

Now, I want to update one of them. I changed it in my .env file, and ran heroku config:push again. The push said it was successful, but when I run heroku config, I can see that the values actually haven't changed. I've tried running heroku restart, but that didn't do anything.

How can I update my environment variables in heroku?

like image 467
Andrew Avatar asked Dec 24 '12 02:12

Andrew


People also ask

How do I change my environment variables in Heroku?

One way of setting the environment variables on Heroku is to use the web interface. The first step is to log into your account and go to the Heroku dashboard. Figure 1 illustrates my dashboard. Choose the application for which you want to set the environment variables.

Does .env work in Heroku?

env file on Heroku isn't a good approach. Instead, you can use its built-in support for environment variables, using heroku config:set <var> <value> or its web UI. Either way, you'll get a regular environment variable.

Are Heroku config vars safe?

Heroku config vars are designed to be safe for storing sensitive information. All config vars are stored in an encrypted form and safely stored. These are only decrypted and loaded when booting your app in a dyno itself.


1 Answers

Figured it out. You need to run heroku config:push --overwrite because it won't overwrite existing variables by default. This is poorly documented :-/

like image 169
Andrew Avatar answered Sep 20 '22 23:09

Andrew