Erick Petrucelli
Erick Petrucelli

Reputation: 14872

Deploying to Heroku from Github with settings.json in .gitignore

Since Meteor free hosting is going away, I'm trying to deploy one of my apps to Heroku. It seems to be good practice to deploy with a Github repository.

For security reasons, my settings.json is inside .gitignore and hasn't been pushed to my Github repo.

This didn't present any problem with Meteor hosting, since the meteor deploy --settings settings.json worked with the local file.

Now, with Heroku there are issues. Even using heroku config:set METEOR_SETTINGS="$(cat settings.json)" doesn't work since it can't identify the settings file.

Is there something wrong with this approach? Do I have to push settings.json directly to Heroku even with the integration active? If so how do I do this?

Upvotes: 1

Views: 216

Answers (1)

maxbeizer
maxbeizer

Reputation: 857

The Heroku approach to this problem is based on their 12factor App config philosophy (see the paragraph that starts with "The twelve-factor app stores config in environment variables"). So the way to do this is to move your configs from settings.json to config vars. This would be an example:

heroku config:set MY_VAR=myValue MY_VAR2=myOtherValue -a myApp

It looks like the OP already knows this approach, he'll just have to take it for each key value pair in settings.json. The benefit of this approach is that if you bring more people onto the project, you don't have to find a way to securely transfer this info; authorized users can get the creds they need with heroku config -a myApp. You could also visit the heroku dashboard and add the settings via the web interface, if that's easier for you.

Upvotes: 1

Related Questions