ddollar/heroku-config

Having trouble pushing config

dideler opened this issue · 3 comments

The config:push option isn't giving desired behaviour, the values its pushing don't get set on Heroku.


I have an .env file for my staging environment at config/heroku.env.staging. The content is in shell format (because the Rails app is using the dotenv-deployment gem).

# config/heroku.env.staging
RACK_ENV=staging
RAILS_ENV=staging
...

I want to push these environment variables to my staging environment on Heroku. I tried both ways:

↪ heroku config:push --env=config/heroku.env.staging --app my-app-staging
Config in config/heroku.env.staging written to my-app-staging

↪ cat config/heroku.env.staging | heroku config:push --app my-app-staging
Config in STDIN written to my-app-staging

The output says it was successful but when I look at the environment variables for the app on Heroku, the values for RACK_ENV and RAILS_ENV haven't changed:

↪ heroku config --app my-app-staging
=== my-app-staging Config Vars
RACK_ENV:                       production
RAILS_ENV:                      production
...

It does work when I try to set a single environment variable with config:set (i.e. not using this plugin):

↪ heroku config:set RAILS_ENV=staging --app my-app-staging
Setting config vars and restarting my-app-staging... done, v53
RAILS_ENV: staging

I can confirm with config:get:

↪ heroku config:get RAILS_ENV --app my-app-staging
staging

Notice that with config:set it also restarts the app. Could that make a difference in the state being set/persisted?

I just did another config:push but this time the .env file contained new environment variables, and those did get pushed. So it seems that if the key already exists, it doesn't get overridden.

The README does mention this, but only for pull

# by default, all existing keys will not be overwritten
$ heroku config:pull
Config for example written to .env

# optional --overwrite allows you to have the pull overwrite keys
$ heroku config:pull --overwrite
Config for example written to .env

I tried pushing with --overwrite and it worked. I'll open a PR to make the README more clear.

I no longer use Heroku day to day so I am no longer going to be maintaining this plugin. If you'd like to submit a pull request that solves the issue I would be happy to take a look and merge..

Hey @ddollar, see #27

Are you looking for a new maintainer?