Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to set Heroku config var with contents of a file

Tags:

To set config vars for a Heroku app, you do this:

$ heroku config:set GITHUB_USERNAME=joesmith 

How would I set a config var with the contents of a file?

like image 466
Yarin Avatar asked Sep 15 '13 18:09

Yarin


People also ask

Does heroku use .ENV file?

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 strings?

All heroku config vars will be environment variables, which, in linux environments, can only be strings. So all your variables will be strings once in your app.


1 Answers

Take a look at the heroku-config plugin, which adds a heroku config:push command to push key-value pairs in a file named .env to the app.

It also has a heroku config:pull command to do the opposite and works very well with foreman for running the app locally with the config in .env.

https://github.com/xavdid/heroku-config

Example
heroku config:push --file=.env.production  
like image 64
ryanbrainard Avatar answered Sep 28 '22 09:09

ryanbrainard