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 = :debug

  config.i18n.fallbacks = true

  config.active_support.deprecation = :notify

  config.log_formatter = ::Logger::Formatter.new

  config.action_mailer.delivery_method = :mailgun
  config.action_mailer.mailgun_settings = {
    api_key: ENV['MAILGUN_APIKEY'],
    domain: ENV['MAILGUN_DOMAIN']
  }

  heroku_app_path = "https://#{ENV['HEROKU_APP_NAME']}.herokuapp.com" if ENV['HEROKU_APP_NAME']
  config.action_mailer.default_url_options = { host: ENV['SCREENSMART_URL'] ||
                                                     heroku_app_path ||
                                                     'https://screensmart.herokuapp.com' }
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 = :debug

  config.i18n.fallbacks = true

  config.active_support.deprecation = :notify

  config.log_formatter = ::Logger::Formatter.new

  config.action_mailer.delivery_method = :mailgun
  config.action_mailer.mailgun_settings = {
    api_key: ENV['MAILGUN_APIKEY'],
    domain: ENV['MAILGUN_DOMAIN']
  }

  roqua_server_app_path = "https://#{ENV['SCREENSMART_URL']}" if ENV['SCREENSMART_URL']
  heroku_app_path = "https://#{ENV['HEROKU_APP_NAME']}.herokuapp.com" if ENV['HEROKU_APP_NAME']
  config.action_mailer.default_url_options = { host: roqua_server_app_path ||
                                                     heroku_app_path ||
                                                     'https://screensmart.herokuapp.com' }
end

Include https in root url
Include https in root url
