]> git.openstreetmap.org Git - rails.git/blob - config/application.rb
Use jquery
[rails.git] / config / application.rb
1 require_relative "boot"
2
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"
13 else
14   require "rails/all"
15 end
16
17 # Require the gems listed in Gemfile, including any gems
18 # you've limited to :test, :development, or :production.
19 Bundler.require(*Rails.groups)
20
21 module OpenStreetMap
22   class Application < Rails::Application
23     # Initialize configuration defaults for originally generated Rails version.
24     config.load_defaults 5.2
25
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.
30
31     # Custom directories with classes and modules you want to be autoloadable.
32     config.autoload_paths += %W[#{config.root}/lib]
33
34     # This defaults to true from rails 5.0 but our code doesn't comply
35     # with it at all so we turn it off
36     config.active_record.belongs_to_required_by_default = false unless Settings.status == "database_offline"
37
38     # Use SQL instead of Active Record's schema dumper when creating the database.
39     # This is necessary if your schema can't be completely dumped by the schema dumper,
40     # like if you have constraints or database-specific column types
41     config.active_record.schema_format = :sql unless Settings.status == "database_offline"
42
43     # Don't eager load models when the database is offline
44     config.paths["app/models"].skip_eager_load! if Settings.status == "database_offline"
45
46     # Use memcached for caching if required
47     config.cache_store = :mem_cache_store, Settings.memcache_servers, { :namespace => "rails:cache" } if Settings.key?(:memcache_servers)
48
49     # Use logstash for logging if required
50     if Settings.key?(:logstash_path)
51       config.logstasher.enabled = true
52       config.logstasher.suppress_app_log = false
53       config.logstasher.logger_path = Settings.logstash_path
54       config.logstasher.log_controller_parameters = true
55     end
56   end
57 end