Copy/paste from: github.com/rails/rails/blob/5-2-stable/activerecord/lib/active_record/connection_handling.rb
-> { (Rails.env if defined?(Rails) && defined?(Rails.env)) || ENV["RAILS_ENV"].presence || ENV["RACK_ENV"].presence }