Rails.application.configure do
  config.cache_classes = true
  config.eager_load = true
  config.consider_all_requests_local       = false
  config.action_controller.perform_caching = true
  config.serve_static_files = ENV['RAILS_SERVE_STATIC_FILES'].present?
  # config.assets.js_compressor = :uglifier
  config.assets.compile = false
  config.assets.digest = true
  config.log_level = :info
  config.i18n.fallbacks = true
  config.active_support.deprecation = :notify
  config.log_formatter = ::Logger::Formatter.new

  config.force_ssl = true

  config.lograge.formatter = Lograge::Formatters::Logstash.new
  config.lograge.logger = ActiveSupport::Logger.new \
    "#{Rails.root}/log/logstash_#{Rails.env}.json"

  config.staff_url = ENV.fetch('STAFF_SERVICE_URL')

  EmailAddressValidation.configure do |config|
    config.mx_checker = MxChecker.new
  end
end

Rails.application.configure do
  config.cache_classes = true
  config.eager_load = true
  config.consider_all_requests_local       = false
  config.action_controller.perform_caching = true
  config.serve_static_files = ENV['RAILS_SERVE_STATIC_FILES'].present?
  # config.assets.js_compressor = :uglifier
  config.assets.compile = false
  config.assets.digest = true
  config.log_level = :info
  config.i18n.fallbacks = true
  config.active_support.deprecation = :notify
  config.log_formatter = ::Logger::Formatter.new

  config.force_ssl = true if ENV.key?('HEROKU_APP_NAME')

  config.lograge.formatter = Lograge::Formatters::Logstash.new
  config.lograge.logger = ActiveSupport::Logger.new \
    "#{Rails.root}/log/logstash_#{Rails.env}.json"

  config.staff_url = ENV.fetch('STAFF_SERVICE_URL')

  EmailAddressValidation.configure do |config|
    config.mx_checker = MxChecker.new
  end
end

Enforce SSL only in Heroku
Enforce SSL only in Heroku

Enforcing SSL with the Rails setting breaks staging and possibly production.

Staging and Production already enforce SSL, so set it only for Heroku.
