I would check for the existence of `ENV["RAILS_ENV"]` or `ENV["RACK_ENV"]` and use whichever is specified.