How do you deploy an application.yml based config to heroku

In one of my applications, I have the following config files that are excluded from git:

* config/mongoid.yml
* config/application.yml
* config/mailserver_setting.rb
* config/omniauth_settings.rb

For deploying to a regular server, I just add tasks to my capistrano deployment file to create sym-links to a shared directory. In this case I have to modify my application to use local ENV files and consequently the ENV hash in my rails app.

In my configuration.rb (boots at initialization):

config_file =  File.expand_path('../../config/application.yml', __FILE__)
if File.exist?(config_file)
  CONSTANTS.each{|k,v| ENV["CONSTANTS_#{k}"] = v.to_s}

So using the following custom thor task, I can load heroku’s env files based on some code from Les Hill:

This works well.

Leave a Reply

Your email address will not be published.

This site uses Akismet to reduce spam. Learn how your comment data is processed.