diff config/application.rb @ 355:56382cb104dd

Add support for environment variable-based deployment.
author edogawaconan <me@myconan.net>
date Mon, 04 Aug 2014 17:05:16 +0900
parents 7c7b7906ebd9
children 7b58d38c9b6a
line wrap: on
line diff
--- a/config/application.rb	Thu Jul 03 15:22:24 2014 +0900
+++ b/config/application.rb	Mon Aug 04 17:05:16 2014 +0900
@@ -1,5 +1,8 @@
 require File.expand_path("../boot", __FILE__)
 
+# To allow setting environment variable ZP_DATABASE_URL instead of DATABASE_URL.
+ENV["DATABASE_URL"] = ENV["ZP_DATABASE_URL"] if ENV["ZP_DATABASE_URL"]
+
 require "active_record/railtie"
 require "action_controller/railtie"
 # require "action_mailer/railtie"
@@ -8,7 +11,7 @@
 require "rails/test_unit/railtie"
 
 require File.expand_path("../init_config", __FILE__)
-require File.expand_path("../local_config", __FILE__)
+suppress(LoadError) { require File.expand_path("../local_config", __FILE__) }
 require File.expand_path("../default_config", __FILE__)
 
 # Pick the frameworks you want: