changeset 438:a5eae5b07abf

Prepare for removing custom database.yml
author nanaya <me@myconan.net>
date Sat, 02 Jul 2016 17:18:07 +0900
parents d31fe32da7a0
children e8f159807413
files config/application.rb config/config_init.rb
diffstat 2 files changed, 5 insertions(+), 4 deletions(-) [+]
line wrap: on
line diff
--- a/config/application.rb	Sat Jul 02 17:04:25 2016 +0900
+++ b/config/application.rb	Sat Jul 02 17:18:07 2016 +0900
@@ -3,14 +3,14 @@
 # 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_relative "config_init"
+
 require "active_record/railtie"
 require "action_controller/railtie"
 # require "action_mailer/railtie"
 require "sprockets/railtie"
 require "rails/test_unit/railtie"
 
-require_relative "config_init"
-
 # If you precompile assets before deploying to production, use this line
 Bundler.require(*$cfg[:bundler_groups])
 # If you want your assets lazily compiled in production, use this line
--- a/config/config_init.rb	Sat Jul 02 17:04:25 2016 +0900
+++ b/config/config_init.rb	Sat Jul 02 17:18:07 2016 +0900
@@ -2,7 +2,8 @@
 $cfg[:secret_key] = ENV["ZP_SECRET_KEY"]
 $cfg[:newrelic] = ENV["ZP_NEWRELIC"] == 1
 
-config_local = File.expand_path("config_local_#{Rails.env}.rb", __dir__)
+env = ENV["RAILS_ENV"] || ENV["RACK_ENV"] || "development"
+config_local = File.expand_path("config_local_#{env}.rb", __dir__)
 
 require config_local if File.exist? config_local
 
@@ -10,7 +11,7 @@
 $cfg[:newrelic] = false if $cfg[:newrelic].nil?
 $cfg[:log_to_stdout] = true if $cfg[:log_to_stdout].nil?
 
-$cfg[:bundler_groups] ||= [:default, Rails.env]
+$cfg[:bundler_groups] ||= [:default, env]
 $cfg[:bundler_groups] << "standalone" if $cfg[:standalone]
 $cfg[:bundler_groups] << "newrelic" if $cfg[:newrelic]