Patch #35081 » 0002-Update-config-environments-.rb-for-Rails-6.1.patch
| Gemfile | ||
|---|---|---|
| 78 | 78 |
end |
| 79 | 79 | |
| 80 | 80 |
group :development do |
| 81 |
gem 'listen', '~> 3.3' |
|
| 81 | 82 |
gem "yard" |
| 82 | 83 |
end |
| 83 | 84 | |
| config/environments/development.rb | ||
|---|---|---|
| 1 | 1 |
# frozen_string_literal: true |
| 2 | 2 | |
| 3 |
require 'active_support/core_ext/integer/time' |
|
| 4 | ||
| 3 | 5 |
Rails.application.configure do |
| 4 |
# Settings specified here will take precedence over those in config/application.rb |
|
| 6 |
# Settings specified here will take precedence over those in config/application.rb.
|
|
| 5 | 7 | |
| 6 |
# In the development environment your application's code is reloaded on
|
|
| 7 |
# every request. This slows down response time but is perfect for development
|
|
| 8 |
# since you don't have to restart the webserver when you make code changes. |
|
| 8 |
# In the development environment your application's code is reloaded any time
|
|
| 9 |
# it changes. This slows down response time but is perfect for development
|
|
| 10 |
# since you don't have to restart the web server when you make code changes.
|
|
| 9 | 11 |
config.cache_classes = false |
| 10 | 12 | |
| 11 | 13 |
# Do not eager load code on boot. |
| 12 | 14 |
config.eager_load = false |
| 13 | 15 | |
| 14 |
# Show full error reports and disable caching
|
|
| 16 |
# Show full error reports.
|
|
| 15 | 17 |
config.consider_all_requests_local = true |
| 16 |
config.action_controller.perform_caching = false |
|
| 17 | 18 | |
| 18 |
# Disable delivery errors |
|
| 19 |
config.action_mailer.raise_delivery_errors = false |
|
| 19 |
# Enable/disable caching. By default caching is disabled. |
|
| 20 |
# Run rails dev:cache to toggle caching. |
|
| 21 |
if Rails.root.join('tmp', 'caching-dev.txt').exist?
|
|
| 22 |
config.action_controller.perform_caching = true |
|
| 23 |
config.action_controller.enable_fragment_cache_logging = true |
|
| 24 | ||
| 25 |
config.cache_store = :memory_store |
|
| 26 |
config.public_file_server.headers = {
|
|
| 27 |
'Cache-Control' => "public, max-age=#{2.days.to_i}"
|
|
| 28 |
} |
|
| 29 |
else |
|
| 30 |
config.action_controller.perform_caching = false |
|
| 20 | 31 | |
| 21 |
# Print deprecation notices to stderr and the Rails logger. |
|
| 32 |
config.cache_store = :null_store |
|
| 33 |
end |
|
| 34 | ||
| 35 |
# Print deprecation notices to the Rails logger. |
|
| 22 | 36 |
config.active_support.deprecation = [:stderr, :log] |
| 37 | ||
| 38 |
# Raise exceptions for disallowed deprecations. |
|
| 39 |
config.active_support.disallowed_deprecation = :raise |
|
| 40 | ||
| 41 |
# Tell Active Support which deprecation messages to disallow. |
|
| 42 |
config.active_support.disallowed_deprecation_warnings = [] |
|
| 43 | ||
| 44 |
# Raise an error on page load if there are pending migrations. |
|
| 45 |
config.active_record.migration_error = :page_load |
|
| 46 | ||
| 47 |
# Highlight code that triggered database queries in logs. |
|
| 48 |
config.active_record.verbose_query_logs = true |
|
| 49 | ||
| 50 |
# Debug mode disables concatenation and preprocessing of assets. |
|
| 51 |
# This option may cause significant delays in view rendering with a large |
|
| 52 |
# number of complex assets. |
|
| 53 |
# config.assets.debug = true |
|
| 54 | ||
| 55 |
# Suppress logger output for asset requests. |
|
| 56 |
# config.assets.quiet = true |
|
| 57 | ||
| 58 |
# Raises error for missing translations. |
|
| 59 |
# config.i18n.raise_on_missing_translations = true |
|
| 60 | ||
| 61 |
# Annotate rendered view with file names. |
|
| 62 |
# config.action_view.annotate_rendered_view_with_filenames = true |
|
| 63 | ||
| 64 |
# Use an evented file watcher to asynchronously detect changes in source code, |
|
| 65 |
# routes, locales, etc. This feature depends on the listen gem. |
|
| 66 |
config.file_watcher = ActiveSupport::EventedFileUpdateChecker |
|
| 67 | ||
| 68 |
# Uncomment if you wish to allow Action Cable access from any origin. |
|
| 69 |
# config.action_cable.disable_request_forgery_protection = true |
|
| 23 | 70 |
end |
| config/environments/production.rb | ||
|---|---|---|
| 1 | 1 |
# frozen_string_literal: true |
| 2 | 2 | |
| 3 |
require 'active_support/core_ext/integer/time' |
|
| 4 | ||
| 3 | 5 |
Rails.application.configure do |
| 4 |
# Settings specified here will take precedence over those in config/application.rb |
|
| 6 |
# Settings specified here will take precedence over those in config/application.rb.
|
|
| 5 | 7 | |
| 6 | 8 |
# Code is not reloaded between requests. |
| 7 | 9 |
config.cache_classes = true |
| ... | ... | |
| 13 | 15 |
config.eager_load = true |
| 14 | 16 | |
| 15 | 17 |
# Full error reports are disabled and caching is turned on. |
| 16 |
config.consider_all_requests_local = false |
|
| 18 |
config.consider_all_requests_local = false
|
|
| 17 | 19 |
config.action_controller.perform_caching = true |
| 18 | 20 | |
| 21 |
# Ensures that a master key has been made available in either ENV["RAILS_MASTER_KEY"] |
|
| 22 |
# or in config/master.key. This key is used to decrypt credentials (and other encrypted files). |
|
| 23 |
# config.require_master_key = true |
|
| 24 | ||
| 25 |
# Disable serving static files from the `/public` folder by default since |
|
| 26 |
# Apache or NGINX already handles this. |
|
| 27 |
# config.public_file_server.enabled = ENV['RAILS_SERVE_STATIC_FILES'].present? |
|
| 28 | ||
| 29 |
# Compress CSS using a preprocessor. |
|
| 30 |
# config.assets.css_compressor = :sass |
|
| 31 | ||
| 32 |
# Do not fallback to assets pipeline if a precompiled asset is missed. |
|
| 33 |
# config.assets.compile = false |
|
| 34 | ||
| 35 |
# Enable serving of images, stylesheets, and JavaScripts from an asset server. |
|
| 36 |
# config.asset_host = 'http://assets.example.com' |
|
| 37 | ||
| 38 |
# Specifies the header that your server uses for sending files. |
|
| 39 |
# config.action_dispatch.x_sendfile_header = 'X-Sendfile' # for Apache |
|
| 40 |
# config.action_dispatch.x_sendfile_header = 'X-Accel-Redirect' # for NGINX |
|
| 41 | ||
| 42 |
# Force all access to the app over SSL, use Strict-Transport-Security, and use secure cookies. |
|
| 43 |
# config.force_ssl = true |
|
| 44 | ||
| 45 |
# Include generic and useful information about system operation, but avoid logging too much |
|
| 46 |
# information to avoid inadvertent exposure of personally identifiable information (PII). |
|
| 47 |
config.log_level = :info |
|
| 48 | ||
| 49 |
# Prepend all log lines with the following tags. |
|
| 50 |
config.log_tags = [:request_id] |
|
| 51 | ||
| 52 |
# Use a different cache store in production. |
|
| 53 |
# config.cache_store = :mem_cache_store |
|
| 54 | ||
| 55 |
# Enable locale fallbacks for I18n (makes lookups for any locale fall back to |
|
| 56 |
# the I18n.default_locale when a translation cannot be found). |
|
| 57 |
config.i18n.fallbacks = true |
|
| 58 | ||
| 59 |
# Send deprecation notices to registered listeners. |
|
| 60 |
config.active_support.deprecation = :log |
|
| 61 | ||
| 62 |
# Log disallowed deprecations. |
|
| 63 |
config.active_support.disallowed_deprecation = :log |
|
| 64 | ||
| 65 |
# Tell Active Support which deprecation messages to disallow. |
|
| 66 |
config.active_support.disallowed_deprecation_warnings = [] |
|
| 67 | ||
| 68 |
# Use default logging formatter so that PID and timestamp are not suppressed. |
|
| 69 |
config.log_formatter = ::Logger::Formatter.new |
|
| 70 | ||
| 71 |
# Use a different logger for distributed setups. |
|
| 72 |
# require "syslog/logger" |
|
| 73 |
# config.logger = ActiveSupport::TaggedLogging.new(Syslog::Logger.new 'app-name') |
|
| 74 | ||
| 75 |
if ENV["RAILS_LOG_TO_STDOUT"].present? |
|
| 76 |
logger = ActiveSupport::Logger.new(STDOUT) |
|
| 77 |
logger.formatter = config.log_formatter |
|
| 78 |
config.logger = ActiveSupport::TaggedLogging.new(logger) |
|
| 79 |
end |
|
| 80 | ||
| 81 |
# Do not dump schema after migrations. |
|
| 82 |
config.active_record.dump_schema_after_migration = false |
|
| 83 | ||
| 84 |
# Inserts middleware to perform automatic connection switching. |
|
| 85 |
# The `database_selector` hash is used to pass options to the DatabaseSelector |
|
| 86 |
# middleware. The `delay` is used to determine how long to wait after a write |
|
| 87 |
# to send a subsequent read to the primary. |
|
| 88 |
# |
|
| 89 |
# The `database_resolver` class is used by the middleware to determine which |
|
| 90 |
# database is appropriate to use based on the time delay. |
|
| 91 |
# |
|
| 92 |
# The `database_resolver_context` class is used by the middleware to set |
|
| 93 |
# timestamps for the last write to the primary. The resolver uses the context |
|
| 94 |
# class timestamps to determine how long to wait before reading from the |
|
| 95 |
# replica. |
|
| 96 |
# |
|
| 97 |
# By default Rails will store a last write timestamp in the session. The |
|
| 98 |
# DatabaseSelector middleware is designed as such you can define your own |
|
| 99 |
# strategy for connection switching and pass that into the middleware through |
|
| 100 |
# these configuration options. |
|
| 101 |
# config.active_record.database_selector = { delay: 2.seconds }
|
|
| 102 |
# config.active_record.database_resolver = ActiveRecord::Middleware::DatabaseSelector::Resolver |
|
| 103 |
# config.active_record.database_resolver_context = ActiveRecord::Middleware::DatabaseSelector::Resolver::Session |
|
| 104 | ||
| 19 | 105 |
# Disable delivery errors |
| 20 | 106 |
config.action_mailer.raise_delivery_errors = false |
| 21 | 107 | |
| 22 | 108 |
# No email in production log |
| 23 | 109 |
config.action_mailer.logger = nil |
| 24 | ||
| 25 |
# Print deprecation notices to the Rails logger. |
|
| 26 |
config.active_support.deprecation = :log |
|
| 27 | 110 |
end |
| config/environments/test.rb | ||
|---|---|---|
| 1 | 1 |
# frozen_string_literal: true |
| 2 | 2 | |
| 3 |
require 'active_support/core_ext/integer/time' |
|
| 4 | ||
| 5 |
# The test environment is used exclusively to run your application's |
|
| 6 |
# test suite. You never need to work with it otherwise. Remember that |
|
| 7 |
# your test database is "scratch space" for the test suite and is wiped |
|
| 8 |
# and recreated between test runs. Don't rely on the data there! |
|
| 9 | ||
| 3 | 10 |
Rails.application.configure do |
| 4 |
# Settings specified here will take precedence over those in config/application.rb |
|
| 11 |
# Settings specified here will take precedence over those in config/application.rb.
|
|
| 5 | 12 | |
| 6 |
# The test environment is used exclusively to run your application's |
|
| 7 |
# test suite. You never need to work with it otherwise. Remember that |
|
| 8 |
# your test database is "scratch space" for the test suite and is wiped |
|
| 9 |
# and recreated between test runs. Don't rely on the data there! |
|
| 10 | 13 |
config.cache_classes = true |
| 14 |
# config.action_view.cache_template_loading = true |
|
| 11 | 15 | |
| 12 | 16 |
# Do not eager load code on boot. This avoids loading your whole application |
| 13 | 17 |
# just for the purpose of running a single test. If you are using a tool that |
| 14 | 18 |
# preloads Rails for running tests, you may have to set it to true. |
| 15 | 19 |
config.eager_load = false |
| 16 | 20 | |
| 17 |
# Show full error reports and disable caching |
|
| 18 |
config.consider_all_requests_local = true |
|
| 21 |
# Configure public file server for tests with Cache-Control for performance. |
|
| 22 |
config.public_file_server.enabled = true |
|
| 23 |
config.public_file_server.headers = {
|
|
| 24 |
'Cache-Control' => "public, max-age=#{1.hour.to_i}"
|
|
| 25 |
} |
|
| 26 | ||
| 27 |
# Show full error reports and disable caching. |
|
| 28 |
config.consider_all_requests_local = true |
|
| 19 | 29 |
config.action_controller.perform_caching = false |
| 30 |
config.cache_store = :null_store |
|
| 31 | ||
| 32 |
# Raise exceptions instead of rendering exception templates. |
|
| 33 |
config.action_dispatch.show_exceptions = true |
|
| 34 | ||
| 35 |
# Disable request forgery protection in test environment. |
|
| 36 |
config.action_controller.allow_forgery_protection = false |
|
| 37 | ||
| 38 |
# Disable sessions verifications in test environment. |
|
| 39 |
config.redmine_verify_sessions = false |
|
| 40 | ||
| 41 |
# Store uploaded files on the local file system in a temporary directory. |
|
| 42 |
# config.active_storage.service = :test |
|
| 43 | ||
| 44 |
config.action_mailer.perform_caching = false |
|
| 20 | 45 | |
| 21 | 46 |
config.action_mailer.perform_deliveries = true |
| 22 | 47 | |
| ... | ... | |
| 28 | 53 |
# Disable Async delivery |
| 29 | 54 |
config.active_job.queue_adapter = :inline |
| 30 | 55 | |
| 31 |
# Disable request forgery protection in test environment. |
|
| 32 |
config.action_controller.allow_forgery_protection = false |
|
| 33 | ||
| 34 |
# Disable sessions verifications in test environment. |
|
| 35 |
config.redmine_verify_sessions = false |
|
| 36 | ||
| 37 |
# Print deprecation notices to stderr and the Rails logger. |
|
| 56 |
# Print deprecation notices to the stderr. |
|
| 38 | 57 |
config.active_support.deprecation = [:stderr, :log] |
| 39 | 58 | |
| 40 |
config.secret_key_base = 'a secret token for running the tests' |
|
| 59 |
# Raise exceptions for disallowed deprecations. |
|
| 60 |
config.active_support.disallowed_deprecation = :raise |
|
| 61 | ||
| 62 |
# Tell Active Support which deprecation messages to disallow. |
|
| 63 |
config.active_support.disallowed_deprecation_warnings = [] |
|
| 41 | 64 | |
| 42 | 65 |
config.active_support.test_order = :random |
| 66 | ||
| 67 |
# Raises error for missing translations. |
|
| 68 |
# config.i18n.raise_on_missing_translations = true |
|
| 69 | ||
| 70 |
# Annotate rendered view with file names. |
|
| 71 |
# config.action_view.annotate_rendered_view_with_filenames = true |
|
| 72 | ||
| 73 |
config.secret_key_base = 'a secret token for running the tests' |
|
| 43 | 74 |
end |