1 require_relative "boot"
 
   3 if ENV["OPENSTREETMAP_STATUS"] == "database_offline"
 
   4   require "active_model/railtie"
 
   5   require "active_job/railtie"
 
   6   require "active_storage/engine"
 
   7   require "action_controller/railtie"
 
   8   require "action_mailer/railtie"
 
   9   require "action_view/railtie"
 
  10   require "action_cable/engine"
 
  11   require "sprockets/railtie"
 
  12   require "rails/test_unit/railtie"
 
  17 # Require the gems listed in Gemfile, including any gems
 
  18 # you've limited to :test, :development, or :production.
 
  19 Bundler.require(*Rails.groups)
 
  22   class Application < Rails::Application
 
  23     # Initialize configuration defaults for originally generated Rails version.
 
  24     config.load_defaults 6.0
 
  26     # Settings in config/environments/* take precedence over those specified here.
 
  27     # Application configuration can go into files in config/initializers
 
  28     # -- all .rb files in that directory are automatically loaded after loading
 
  29     # the framework and any gems in your application.
 
  31     # Custom directories with classes and modules you want to be autoloadable.
 
  32     config.autoload_paths += %W[#{config.root}/lib]
 
  34     # Continue to use the classic autoloader for now
 
  35     config.autoloader = :classic
 
  37     # Force requests from old versions of IE (<= IE8) to be UTF-8 encoded.
 
  38     # This has defaulted to false since rails 6.0
 
  39     config.action_view.default_enforce_utf8 = true
 
  41     # This defaults to true from rails 5.0 but our code doesn't comply
 
  42     # with it at all so we turn it off
 
  43     config.active_record.belongs_to_required_by_default = false unless Settings.status == "database_offline"
 
  45     # Use SQL instead of Active Record's schema dumper when creating the database.
 
  46     # This is necessary if your schema can't be completely dumped by the schema dumper,
 
  47     # like if you have constraints or database-specific column types
 
  48     config.active_record.schema_format = :sql unless Settings.status == "database_offline"
 
  50     # Don't eager load models when the database is offline
 
  51     config.paths["app/models"].skip_eager_load! if Settings.status == "database_offline"
 
  53     # Use memcached for caching if required
 
  54     config.cache_store = :mem_cache_store, Settings.memcache_servers, { :namespace => "rails:cache" } if Settings.key?(:memcache_servers)
 
  56     # Enable locale fallbacks for I18n (makes lookups for any locale fall back to
 
  57     # the I18n.default_locale when a translation cannot be found).
 
  58     config.i18n.fallbacks = true
 
  60     # Use logstash for logging if required
 
  61     if Settings.key?(:logstash_path)
 
  62       config.logstasher.enabled = true
 
  63       config.logstasher.suppress_app_log = false
 
  64       config.logstasher.logger_path = Settings.logstash_path
 
  65       config.logstasher.log_controller_parameters = true