From 3242a68312f54a226595df35b03d19927996b124 Mon Sep 17 00:00:00 2001 From: Teddy Wing Date: Sat, 29 Apr 2017 19:43:09 +0200 Subject: dbshell.rake: Use correct RAILS_ENV Remove our hard-coded "development" environment and instead get the current environment dynamically via the `RAILS_ENV` environment variable. Assume that the current environment is "development" if the env variable is unset. --- lib/dbshell/rails/tasks/dbshell.rake | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/lib/dbshell/rails/tasks/dbshell.rake b/lib/dbshell/rails/tasks/dbshell.rake index 5d19338..0505e38 100644 --- a/lib/dbshell/rails/tasks/dbshell.rake +++ b/lib/dbshell/rails/tasks/dbshell.rake @@ -2,7 +2,9 @@ require 'dbshell/sqlite3_client' task :dbshell do # {"default"=>{"adapter"=>"sqlite3", "pool"=>5, "timeout"=>5000}, "development"=>{"adapter"=>"sqlite3", "pool"=>5, "timeout"=>5000, "database"=>"db/development.sqlite3"}, "test"=>{"adapter"=>"sqlite3", "pool"=>5, "timeout"=>5000, "database"=>"db/test.sqlite3"}, "production"=>{"adapter"=>"sqlite3", "pool"=>5, "timeout"=>5000, "database"=>"db/production.sqlite3"}} + env = ENV.fetch('RAILS_ENV', 'development') + DBShell::Sqlite3Client.runshell( - Rails.application.config.database_configuration['development'] + Rails.application.config.database_configuration[env] ) end -- cgit v1.2.3