Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Remove duplication between staging.rb and production.rb

Tags:

I have a staging and production environment for my Rails application (running on Heroku). At the moment, there is a lot of stuff in staging.rb and production.rb that I'm having to define separately in each file, e.g.:

  # Code is not reloaded between requests
  config.cache_classes = true

  # Full error reports are disabled and caching is turned on
  config.consider_all_requests_local       = false
  config.action_controller.perform_caching = true

  # Disable Rails's static asset server (Apache or nginx will already do this)
  config.serve_static_assets = false

  # Compress JavaScripts and CSS
  config.assets.compress = true

  # Don't fallback to assets pipeline if a precompiled asset is missed
  config.assets.compile = false

  # Generate digests for assets URLs
  config.assets.digest = true

This is not DRY. Is there an elegant way that I can effectively import the settings from production.rb into staging.rb and then just override the settings which I wish to change for the staging environment?