Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Deploying to Heroku with sensitive setting information

I'm using GitHub for code and Heroku for the deployment platform for my rails app.

I don't want to have sensitive data under Git. Such data include database file settings (database.yml) and some other files that have secret API keys.

When I deploy to heroku, how can I deal with files that are not under revision control.

When I use Capistrano, I can write some hook methods, but I don't know what to do with Heroku.

like image 246
TK. Avatar asked Jun 03 '10 06:06

TK.


People also ask

Is it safe to deploy on Heroku?

Heroku is notified of vulnerabilities through internal and external assessments, system patch monitoring, and third party mailing lists and services. Each vulnerability is reviewed to determine if it is applicable to Heroku's environment, ranked based on risk, and assigned to the appropriate team for resolution.

Does Heroku read .ENV file?

Heroku Local is a command-line tool to run Procfile-backed apps. It is installed automatically as part of the Heroku CLI. Heroku Local reads configuration variables from a . env file.


1 Answers

For Heroku, you'll need to have database.yml under Git because Heroku will automatically read it and create a PostgreSQL configuration from it.

For other sensitive information such as API keys, Heroku provide config vars which are effectively environment variables. You can add them using:

heroku config:add KEY=value

—and access them from within your application using:

ENV['KEY']

Note that config vars can be listed, added and removed using the heroku command-line program and that once set they are persistent.

  • Heroku Config Vars documentation
like image 156
John Topley Avatar answered Sep 21 '22 14:09

John Topley