Skip to content

Commit 2db5e57

Browse files
committed
update config files for rails 6.1.7
1 parent db6b0e1 commit 2db5e57

11 files changed

+136
-23
lines changed

Diff for: config.ru

+2-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
# This file is used by Rack-based servers to start the application.
22

3-
require_relative 'config/environment'
3+
require_relative "config/environment"
44

55
run Rails.application
6+
Rails.application.load_server

Diff for: config/application.rb

+8-5
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
require_relative 'boot'
1+
require_relative "boot"
22

33
require "rails"
44
# Pick the frameworks you want:
@@ -24,10 +24,13 @@ class Application < Rails::Application
2424
# Initialize configuration defaults for originally generated Rails version.
2525
config.load_defaults 5.0
2626

27-
# Settings in config/environments/* take precedence over those specified here.
28-
# Application configuration can go into files in config/initializers
29-
# -- all .rb files in that directory are automatically loaded after loading
30-
# the framework and any gems in your application.
27+
# Configuration for the application, engines, and railties goes here.
28+
#
29+
# These settings can be overridden in specific environments using the files
30+
# in config/environments, which are processed later.
31+
#
32+
# config.time_zone = "Central Time (US & Canada)"
33+
# config.eager_load_paths << Rails.root.join("extras")
3134

3235
# Only loads a smaller set of middleware suitable for API only apps.
3336
# Middleware like session, flash, cookies can be added back manually.

Diff for: config/boot.rb

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
ENV['BUNDLE_GEMFILE'] ||= File.expand_path('../Gemfile', __dir__)
22

3-
require 'bundler/setup' # Set up gems listed in the Gemfile.
4-
require 'bootsnap/setup' # Speed up boot time by caching expensive operations.
3+
require "bundler/setup" # Set up gems listed in the Gemfile.
4+
require "bootsnap/setup" # Speed up boot time by caching expensive operations.

Diff for: config/environment.rb

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
# Load the Rails application.
2-
require_relative 'application'
2+
require_relative "application"
33

44
# Initialize the Rails application.
55
Rails.application.initialize!

Diff for: config/environments/development.rb

+17-3
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,10 @@
1+
require "active_support/core_ext/integer/time"
2+
13
Rails.application.configure do
24
# Settings specified here will take precedence over those in config/application.rb.
35

4-
# In the development environment your application's code is reloaded on
5-
# every request. This slows down response time but is perfect for development
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
68
# since you don't have to restart the web server when you make code changes.
79
config.cache_classes = false
810

@@ -36,6 +38,12 @@
3638
# Print deprecation notices to the Rails logger.
3739
config.active_support.deprecation = :log
3840

41+
# Raise exceptions for disallowed deprecations.
42+
config.active_support.disallowed_deprecation = :raise
43+
44+
# Tell Active Support which deprecation messages to disallow.
45+
config.active_support.disallowed_deprecation_warnings = []
46+
3947
# Raise an error on page load if there are pending migrations.
4048
config.active_record.migration_error = :page_load
4149

@@ -44,11 +52,15 @@
4452

4553

4654
# Raises error for missing translations.
47-
# config.action_view.raise_on_missing_translations = true
55+
# config.i18n.raise_on_missing_translations = true
56+
57+
# Annotate rendered view with file names.
58+
# config.action_view.annotate_rendered_view_with_filenames = true
4859

4960
# Use an evented file watcher to asynchronously detect changes in source code,
5061
# routes, locales, etc. This feature depends on the listen gem.
5162
config.file_watcher = ActiveSupport::EventedFileUpdateChecker
63+
5264
# LOCAL
5365
# Custom dev env logger to empty log more frequently
5466
config.logger = ActiveSupport::TaggedLogging.new(
@@ -62,4 +74,6 @@
6274

6375
config.hosts << "cdrhdev1.unl.edu"
6476
config.hosts << "whitman-dev.unl.edu"
77+
# Uncomment if you wish to allow Action Cable access from any origin.
78+
# config.action_cable.disable_request_forgery_protection = true
6579
end

Diff for: config/environments/production.rb

+13-5
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
require "active_support/core_ext/integer/time"
2+
13
Rails.application.configure do
24
# Settings specified here will take precedence over those in config/application.rb.
35

@@ -22,7 +24,7 @@
2224
config.public_file_server.enabled = ENV['RAILS_SERVE_STATIC_FILES'].present?
2325

2426
# Enable serving of images, stylesheets, and JavaScripts from an asset server.
25-
# config.action_controller.asset_host = 'http://assets.example.com'
27+
# config.asset_host = 'http://assets.example.com'
2628

2729
# Specifies the header that your server uses for sending files.
2830
# config.action_dispatch.x_sendfile_header = 'X-Sendfile' # for Apache
@@ -39,9 +41,9 @@
3941
# Force all access to the app over SSL, use Strict-Transport-Security, and use secure cookies.
4042
# config.force_ssl = true
4143

42-
# Use the lowest log level to ensure availability of diagnostic information
43-
# when problems arise.
44-
config.log_level = :debug
44+
# Include generic and useful information about system operation, but avoid logging too much
45+
# information to avoid inadvertent exposure of personally identifiable information (PII).
46+
config.log_level = :info
4547

4648
# Prepend all log lines with the following tags.
4749
config.log_tags = [ :request_id ]
@@ -66,11 +68,17 @@
6668
# Send deprecation notices to registered listeners.
6769
config.active_support.deprecation = :notify
6870

71+
# Log disallowed deprecations.
72+
config.active_support.disallowed_deprecation = :log
73+
74+
# Tell Active Support which deprecation messages to disallow.
75+
config.active_support.disallowed_deprecation_warnings = []
76+
6977
# Use default logging formatter so that PID and timestamp are not suppressed.
7078
config.log_formatter = ::Logger::Formatter.new
7179

7280
# Use a different logger for distributed setups.
73-
# require 'syslog/logger'
81+
# require "syslog/logger"
7482
# config.logger = ActiveSupport::TaggedLogging.new(Syslog::Logger.new 'app-name')
7583

7684
if ENV["RAILS_LOG_TO_STDOUT"].present?

Diff for: config/environments/test.rb

+13-1
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
require "active_support/core_ext/integer/time"
2+
13
# The test environment is used exclusively to run your application's
24
# test suite. You never need to work with it otherwise. Remember that
35
# your test database is "scratch space" for the test suite and is wiped
@@ -7,6 +9,7 @@
79
# Settings specified here will take precedence over those in config/application.rb.
810

911
config.cache_classes = false
12+
config.action_view.cache_template_loading = true
1013

1114
# Do not eager load code on boot. This avoids loading your whole application
1215
# just for the purpose of running a single test. If you are using a tool that
@@ -43,6 +46,15 @@
4346
# Print deprecation notices to the stderr.
4447
config.active_support.deprecation = :stderr
4548

49+
# Raise exceptions for disallowed deprecations.
50+
config.active_support.disallowed_deprecation = :raise
51+
52+
# Tell Active Support which deprecation messages to disallow.
53+
config.active_support.disallowed_deprecation_warnings = []
54+
4655
# Raises error for missing translations.
47-
# config.action_view.raise_on_missing_translations = true
56+
# config.i18n.raise_on_missing_translations = true
57+
58+
# Annotate rendered view with file names.
59+
# config.action_view.annotate_rendered_view_with_filenames = true
4860
end

Diff for: config/initializers/backtrace_silencers.rb

+4-3
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
11
# Be sure to restart your server when you modify this file.
22

33
# You can add backtrace silencers for libraries that you're using but don't wish to see in your backtraces.
4-
# Rails.backtrace_cleaner.add_silencer { |line| line =~ /my_noisy_library/ }
4+
# Rails.backtrace_cleaner.add_silencer { |line| /my_noisy_library/.match?(line) }
55

6-
# You can also remove all the silencers if you're trying to debug a problem that might stem from framework code.
7-
# Rails.backtrace_cleaner.remove_silencers!
6+
# You can also remove all the silencers if you're trying to debug a problem that might stem from framework code
7+
# by setting BACKTRACE=1 before calling your invocation, like "BACKTRACE=1 ./bin/rails runner 'MyClass.perform'".
8+
Rails.backtrace_cleaner.remove_silencers! if ENV["BACKTRACE"]

Diff for: config/initializers/filter_parameter_logging.rb

+3-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
11
# Be sure to restart your server when you modify this file.
22

33
# Configure sensitive parameters which will be filtered from the log file.
4-
Rails.application.config.filter_parameters += [:password]
4+
Rails.application.config.filter_parameters += [
5+
:passw, :secret, :token, :_key, :crypt, :salt, :certificate, :otp, :ssn
6+
]

Diff for: config/initializers/new_framework_defaults_6_1.rb

+67
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,67 @@
1+
# Be sure to restart your server when you modify this file.
2+
#
3+
# This file contains migration options to ease your Rails 6.1 upgrade.
4+
#
5+
# Once upgraded flip defaults one by one to migrate to the new default.
6+
#
7+
# Read the Guide for Upgrading Ruby on Rails for more info on each option.
8+
9+
# Support for inversing belongs_to -> has_many Active Record associations.
10+
# Rails.application.config.active_record.has_many_inversing = true
11+
12+
# Track Active Storage variants in the database.
13+
# Rails.application.config.active_storage.track_variants = true
14+
15+
# Apply random variation to the delay when retrying failed jobs.
16+
# Rails.application.config.active_job.retry_jitter = 0.15
17+
18+
# Stop executing `after_enqueue`/`after_perform` callbacks if
19+
# `before_enqueue`/`before_perform` respectively halts with `throw :abort`.
20+
# Rails.application.config.active_job.skip_after_callbacks_if_terminated = true
21+
22+
# Specify cookies SameSite protection level: either :none, :lax, or :strict.
23+
#
24+
# This change is not backwards compatible with earlier Rails versions.
25+
# It's best enabled when your entire app is migrated and stable on 6.1.
26+
# Rails.application.config.action_dispatch.cookies_same_site_protection = :lax
27+
28+
# Generate CSRF tokens that are encoded in URL-safe Base64.
29+
#
30+
# This change is not backwards compatible with earlier Rails versions.
31+
# It's best enabled when your entire app is migrated and stable on 6.1.
32+
# Rails.application.config.action_controller.urlsafe_csrf_tokens = true
33+
34+
# Specify whether `ActiveSupport::TimeZone.utc_to_local` returns a time with an
35+
# UTC offset or a UTC time.
36+
# ActiveSupport.utc_to_local_returns_utc_offset_times = true
37+
38+
# Change the default HTTP status code to `308` when redirecting non-GET/HEAD
39+
# requests to HTTPS in `ActionDispatch::SSL` middleware.
40+
# Rails.application.config.action_dispatch.ssl_default_redirect_status = 308
41+
42+
# Use new connection handling API. For most applications this won't have any
43+
# effect. For applications using multiple databases, this new API provides
44+
# support for granular connection swapping.
45+
# Rails.application.config.active_record.legacy_connection_handling = false
46+
47+
# Make `form_with` generate non-remote forms by default.
48+
# Rails.application.config.action_view.form_with_generates_remote_forms = false
49+
50+
# Set the default queue name for the analysis job to the queue adapter default.
51+
# Rails.application.config.active_storage.queues.analysis = nil
52+
53+
# Set the default queue name for the purge job to the queue adapter default.
54+
# Rails.application.config.active_storage.queues.purge = nil
55+
56+
# Set the default queue name for the incineration job to the queue adapter default.
57+
# Rails.application.config.action_mailbox.queues.incineration = nil
58+
59+
# Set the default queue name for the routing job to the queue adapter default.
60+
# Rails.application.config.action_mailbox.queues.routing = nil
61+
62+
# Set the default queue name for the mail deliver job to the queue adapter default.
63+
# Rails.application.config.action_mailer.deliver_later_queue_name = nil
64+
65+
# Generate a `Link` header that gives a hint to modern browsers about
66+
# preloading assets when using `javascript_include_tag` and `stylesheet_link_tag`.
67+
# Rails.application.config.action_view.preload_links_header = true

Diff for: config/puma.rb

+6-1
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,14 @@
88
min_threads_count = ENV.fetch("RAILS_MIN_THREADS") { max_threads_count }
99
threads min_threads_count, max_threads_count
1010

11+
# Specifies the `worker_timeout` threshold that Puma will use to wait before
12+
# terminating a worker in development environments.
13+
#
14+
worker_timeout 3600 if ENV.fetch("RAILS_ENV", "development") == "development"
15+
1116
# Specifies the `port` that Puma will listen on to receive requests; default is 3000.
1217
#
13-
port ENV.fetch("PORT") { 3000 }
18+
port ENV.fetch("PORT") { 3000 }
1419

1520
# Specifies the `environment` that Puma will run in.
1621
#

0 commit comments

Comments
 (0)