Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

gitignore config file for Github but not Heroku

Tags:

git

github

heroku

Got an application that reads from a local config.json file. I have two remote repos - Github and Heroku. The Github repo is public but the contents of the config file are private - therefore I've added a .gitignore to prevent this file from being pushed.

However, when I push the app to Heroku I need the config file to be pushed so that the application can work - how do I deal with this situation?

Note: I'm reluctant to use Config vars as there are lots of settings in the config file.

like image 880
tommyd456 Avatar asked Aug 10 '15 14:08

tommyd456


1 Answers

Here you'll find out how to set options for heroku without commiting your config file.

https://devcenter.heroku.com/articles/config-vars

Use the Heroku CLI’s config, config:set, config:get and config:unset to manage your config vars

$ heroku config:set GITHUB_USERNAME=joesmith
Adding config vars and restarting myapp... done, v12
GITHUB_USERNAME: joesmith

$ heroku config
GITHUB_USERNAME: joesmith
OTHER_VAR:    production

$ heroku config:get GITHUB_USERNAME
joesmith

$ heroku config:unset GITHUB_USERNAME
Unsetting GITHUB_USERNAME and restarting myapp... done, v13

Remember that they have limits on the size of the config file.

If you have a lot of configurations perhaps you can create a script which automates the setting of configurations?

like image 179
Kevin P. Avatar answered Oct 16 '22 08:10

Kevin P.