Skip to content

Commit 15817ff

Browse files
authored
Cleanup default environment files (rails#52999)
* Less verbose explanation * Default Dockerfile config takes care of this with dummy key * This is an common setup to need * Less verbose * Explain what default is * Real is a weak placeholder for a hint at default * Not needed for most out the box * Group together with other logging concerns * Not needed any more * Be more succinct * Not needed * Never made any sense for testing? * Fix test * Default was true, so we still need this * We dont need to turn this off either * Slightly broader
1 parent 516135e commit 15817ff

File tree

4 files changed

+11
-41
lines changed

4 files changed

+11
-41
lines changed

railties/lib/rails/generators/rails/app/templates/config/environments/development.rb.tt

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,7 @@ require "active_support/core_ext/integer/time"
33
Rails.application.configure do
44
# Settings specified here will take precedence over those in config/application.rb.
55

6-
# In the development environment your application's code is reloaded any time
7-
# it changes. This slows down response time but is perfect for development
8-
# since you don't have to restart the web server when you make code changes.
6+
# Make code changes take affect immediately without server restart.
97
config.enable_reloading = true
108

119
# Do not eager load code on boot.
@@ -29,7 +27,7 @@ Rails.application.configure do
2927
config.action_controller.perform_caching = false
3028
end
3129

32-
# Change this to :null_store to avoid any caching.
30+
# Change to :null_store to avoid any caching.
3331
config.cache_store = :memory_store
3432
<%- unless skip_active_storage? -%>
3533

@@ -41,8 +39,7 @@ Rails.application.configure do
4139
# Don't care if the mailer can't send.
4240
config.action_mailer.raise_delivery_errors = false
4341

44-
# Disable caching for Action Mailer templates even if Action Controller
45-
# caching is enabled.
42+
# Make template changes take affect immediately.
4643
config.action_mailer.perform_caching = false
4744

4845
# Set localhost to be used by links generated in mailer templates.

railties/lib/rails/generators/rails/app/templates/config/environments/production.rb.tt

Lines changed: 7 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -6,10 +6,7 @@ Rails.application.configure do
66
# Code is not reloaded between requests.
77
config.enable_reloading = false
88

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.
9+
# Eager load code on boot for better performance and memory savings (ignored by Rake tasks).
1310
config.eager_load = true
1411

1512
# Full error reports are disabled and caching is turned on.
@@ -18,10 +15,6 @@ Rails.application.configure do
1815
config.action_controller.perform_caching = true
1916
<%- end -%>
2017

21-
# Ensures that a master key has been made available in ENV["RAILS_MASTER_KEY"], config/master.key, or an environment
22-
# key such as config/credentials/production.key. This key is used to decrypt credentials (and other encrypted files).
23-
# config.require_master_key = true
24-
2518
# Cache assets for far-future expiry since they are all digest stamped.
2619
config.public_file_server.headers = { "cache-control" => "public, max-age=#{1.year.to_i}" }
2720

@@ -32,13 +25,6 @@ Rails.application.configure do
3225
# Store uploaded files on the local file system (see config/storage.yml for options).
3326
config.active_storage.service = :local
3427

35-
<%- end -%>
36-
<%- unless skip_action_cable? -%>
37-
# Mount Action Cable outside main process or domain.
38-
# config.action_cable.mount_path = nil
39-
# config.action_cable.url = "wss://example.com/cable"
40-
# config.action_cable.allowed_request_origins = [ "http://example.com", /http:\/\/example.*/ ]
41-
4228
<%- end -%>
4329
# Assume all access to the app is happening through a SSL-terminating reverse proxy.
4430
# Can be used together with config.force_ssl for Strict-Transport-Security and secure cookies.
@@ -57,25 +43,21 @@ Rails.application.configure do
5743
config.log_tags = [ :request_id ]
5844
config.logger = ActiveSupport::TaggedLogging.logger(STDOUT)
5945

60-
# "info" includes generic and useful information about system operation, but avoids logging too much
61-
# information to avoid inadvertent exposure of personally identifiable information (PII). If you
62-
# want to log everything, set the level to "debug".
46+
# Change to "debug" to log everything (including potentially personally-identifiable information!)
6347
config.log_level = ENV.fetch("RAILS_LOG_LEVEL", "info")
6448

65-
# Use a different cache store in production.
49+
# Don't log any deprecations.
50+
config.active_support.report_deprecations = false
51+
52+
# Replace the default in-process memory cache store with a durable alternative.
6653
# config.cache_store = :mem_cache_store
6754

6855
<%- unless options[:skip_active_job] -%>
69-
# Use a real queuing backend for Active Job (and separate queues per environment).
56+
# Replace the default in-process and non-durable queuing backend for Active Job.
7057
# config.active_job.queue_adapter = :resque
71-
# config.active_job.queue_name_prefix = "<%= app_name %>_production"
7258

7359
<%- end -%>
7460
<%- unless options.skip_action_mailer? -%>
75-
# Disable caching for Action Mailer templates even if Action Controller
76-
# caching is enabled.
77-
config.action_mailer.perform_caching = false
78-
7961
# Ignore bad email addresses and do not raise email delivery errors.
8062
# Set this to true and configure the email server for immediate delivery to raise delivery errors.
8163
# config.action_mailer.raise_delivery_errors = false
@@ -96,9 +78,6 @@ Rails.application.configure do
9678
# Enable locale fallbacks for I18n (makes lookups for any locale fall back to
9779
# the I18n.default_locale when a translation cannot be found).
9880
config.i18n.fallbacks = true
99-
100-
# Don't log any deprecations.
101-
config.active_support.report_deprecations = false
10281
<%- unless options.skip_active_record? -%>
10382

10483
# Do not dump schema after migrations.

railties/lib/rails/generators/rails/app/templates/config/environments/test.rb.tt

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -18,9 +18,8 @@ Rails.application.configure do
1818
# Configure public file server for tests with cache-control for performance.
1919
config.public_file_server.headers = { "cache-control" => "public, max-age=3600" }
2020

21-
# Show full error reports and disable caching.
21+
# Show full error reports.
2222
config.consider_all_requests_local = true
23-
config.action_controller.perform_caching = false
2423
config.cache_store = :null_store
2524

2625
# Render exception templates for rescuable exceptions and raise for other exceptions.
@@ -35,10 +34,6 @@ Rails.application.configure do
3534

3635
<%- end -%>
3736
<%- unless options.skip_action_mailer? -%>
38-
# Disable caching for Action Mailer templates even if Action Controller
39-
# caching is enabled.
40-
config.action_mailer.perform_caching = false
41-
4237
# Tell Action Mailer not to deliver emails to the real world.
4338
# The :test delivery method accumulates sent emails in the
4439
# ActionMailer::Base.deliveries array.

railties/test/generators/shared_generator_tests.rb

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,6 @@ def test_codebase_is_created
9191
end
9292
assert_file "#{application_path}/config/environments/production.rb" do |content|
9393
assert_match(/# config\.action_mailer\.raise_delivery_errors = false/, content)
94-
assert_match(/^ # config\.require_master_key = true/, content)
9594
assert_match(/config\.active_storage/, content)
9695
end
9796

0 commit comments

Comments
 (0)