diff options
author | Teddy Wing | 2017-04-29 19:43:09 +0200 |
---|---|---|
committer | Teddy Wing | 2017-04-29 19:43:09 +0200 |
commit | 3242a68312f54a226595df35b03d19927996b124 (patch) | |
tree | 854664f5e7441dcd072abab970853d78ceb75c98 | |
parent | 9f741398657ca47483211ffa6cb0a9dfbe3f88c8 (diff) | |
download | dbshell-rails-3242a68312f54a226595df35b03d19927996b124.tar.bz2 |
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.
-rw-r--r-- | lib/dbshell/rails/tasks/dbshell.rake | 4 |
1 files changed, 3 insertions, 1 deletions
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 |