]> git.openstreetmap.org Git - rails.git/blob - config/environments/production.rb
730f1dcfd208d27062e918915b17604b35028c10
[rails.git] / config / environments / production.rb
1 require "active_support/core_ext/integer/time"
2
3 Rails.application.configure do
4   # Settings specified here will take precedence over those in config/application.rb.
5
6   # Code is not reloaded between requests.
7   config.cache_classes = true
8
9   # Eager load code on boot. This eager loads most of Rails and
10   # your application in memory, allowing both threaded web servers
11   # and those relying on copy on write to perform better.
12   # Rake tasks automatically ignore this option for performance.
13   config.eager_load = true
14
15   # Full error reports are disabled and caching is turned on.
16   config.consider_all_requests_local       = false
17   config.action_controller.perform_caching = true
18
19   # Ensures that a master key has been made available in either ENV["RAILS_MASTER_KEY"]
20   # or in config/master.key. This key is used to decrypt credentials (and other encrypted files).
21   # config.require_master_key = true
22
23   # Disable serving static files from the `/public` folder by default since
24   # Apache or NGINX already handles this.
25   config.public_file_server.enabled = ENV["RAILS_SERVE_STATIC_FILES"].present?
26
27   # Compress JavaScripts and CSS.
28   config.assets.js_compressor = Terser.new
29   # config.assets.css_compressor = :sass
30
31   # Do not fallback to assets pipeline if a precompiled asset is missed.
32   config.assets.compile = false
33
34   # Enable serving of images, stylesheets, and JavaScripts from an asset server.
35   # config.asset_host = 'http://assets.example.com'
36
37   # Specifies the header that your server uses for sending files.
38   # config.action_dispatch.x_sendfile_header = 'X-Sendfile' # for Apache
39   # config.action_dispatch.x_sendfile_header = 'X-Accel-Redirect' # for NGINX
40
41   # Store uploaded files on the local file system (see config/storage.yml for options).
42   config.active_storage.service = :local
43
44   # Mount Action Cable outside main process or domain.
45   # config.action_cable.mount_path = nil
46   # config.action_cable.url = 'wss://example.com/cable'
47   # config.action_cable.allowed_request_origins = [ 'http://example.com', /http:\/\/example.*/ ]
48
49   # Force all access to the app over SSL, use Strict-Transport-Security, and use secure cookies.
50   # config.force_ssl = true
51
52   # Include generic and useful information about system operation, but avoid logging too much
53   # information to avoid inadvertent exposure of personally identifiable information (PII).
54   config.log_level = :info
55
56   # Prepend all log lines with the following tags.
57   config.log_tags = [:request_id]
58
59   # Use a different log path in production.
60   config.paths["log"] = Settings.log_path if Settings.key?(:log_path)
61
62   # Use a different cache store in production.
63   # config.cache_store = :mem_cache_store
64
65   # Use a real queuing backend for Active Job (and separate queues per environment).
66   # config.active_job.queue_adapter     = :resque
67   # config.active_job.queue_name_prefix = "openstreetmap_production"
68
69   config.action_mailer.perform_caching = false
70
71   # Configure caching of static assets
72   config.action_controller.page_cache_directory = Rails.public_path
73
74   # Ignore bad email addresses and do not raise email delivery errors.
75   # Set this to true and configure the email server for immediate delivery to raise delivery errors.
76   # config.action_mailer.raise_delivery_errors = false
77
78   # Enable locale fallbacks for I18n (makes lookups for any locale fall back to
79   # the I18n.default_locale when a translation cannot be found).
80   config.i18n.fallbacks = true
81
82   # Send deprecation notices to registered listeners.
83   config.active_support.deprecation = :notify
84
85   # Log disallowed deprecations.
86   config.active_support.disallowed_deprecation = :log
87
88   # Tell Active Support which deprecation messages to disallow.
89   config.active_support.disallowed_deprecation_warnings = []
90
91   # Use default logging formatter so that PID and timestamp are not suppressed.
92   config.log_formatter = ::Logger::Formatter.new
93
94   # Use a different logger for distributed setups.
95   # require 'syslog/logger'
96   # config.logger = ActiveSupport::TaggedLogging.new(Syslog::Logger.new 'app-name')
97
98   if ENV["RAILS_LOG_TO_STDOUT"].present?
99     logger           = ActiveSupport::Logger.new($stdout)
100     logger.formatter = config.log_formatter
101     config.logger    = ActiveSupport::TaggedLogging.new(logger)
102   end
103
104   # Do not dump schema after migrations.
105   config.active_record.dump_schema_after_migration = false unless Settings.status == "database_offline"
106
107   # Inserts middleware to perform automatic connection switching.
108   # The `database_selector` hash is used to pass options to the DatabaseSelector
109   # middleware. The `delay` is used to determine how long to wait after a write
110   # to send a subsequent read to the primary.
111   #
112   # The `database_resolver` class is used by the middleware to determine which
113   # database is appropriate to use based on the time delay.
114   #
115   # The `database_resolver_context` class is used by the middleware to set
116   # timestamps for the last write to the primary. The resolver uses the context
117   # class timestamps to determine how long to wait before reading from the
118   # replica.
119   #
120   # By default Rails will store a last write timestamp in the session. The
121   # DatabaseSelector middleware is designed as such you can define your own
122   # strategy for connection switching and pass that into the middleware through
123   # these configuration options.
124   # config.active_record.database_selector = { delay: 2.seconds }
125   # config.active_record.database_resolver = ActiveRecord::Middleware::DatabaseSelector::Resolver
126   # config.active_record.database_resolver_context = ActiveRecord::Middleware::DatabaseSelector::Resolver::Session
127
128   # Enable autoloading of dependencies.
129   config.enable_dependency_loading = true
130
131   # Use delayed job to queue jobs in production.
132   config.active_job.queue_adapter = :delayed_job
133 end