Skip to content

Commit 0f3423c

Browse files
authored
Merge pull request #871 from alphagov/rails-7.1
Upgrade to Rails 7.1
2 parents 62a22c3 + 57b705b commit 0f3423c

File tree

7 files changed

+65
-67
lines changed

7 files changed

+65
-67
lines changed

config/application.rb

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,10 +18,15 @@
1818
# you've limited to :test, :development, or :production.
1919
Bundler.require(*Rails.groups)
2020

21-
module HMRCManualsAPI
21+
module HmrcManualsApi
2222
class Application < Rails::Application
2323
# Initialize configuration defaults for originally generated Rails version.
24-
config.load_defaults 7.0
24+
config.load_defaults 7.1
25+
26+
# Please, add to the `ignore` list any other `lib` subdirectories that do
27+
# not contain `.rb` files, or that should not be reloaded or eager loaded.
28+
# Common ones are `templates`, `generators`, or `middleware`, for example.
29+
config.autoload_lib(ignore: %w[assets tasks])
2530

2631
# Configuration for the application, engines, and railties goes here.
2732
#
@@ -30,6 +35,7 @@ class Application < Rails::Application
3035
#
3136
# config.time_zone = "Central Time (US & Canada)"
3237
# config.eager_load_paths << Rails.root.join("extras")
38+
3339
config.middleware.insert_after(Rack::Runtime, Rack::MethodOverride)
3440
end
3541
end

config/environments/development.rb

Lines changed: 5 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
# In the development environment your application's code is reloaded any time
77
# it changes. This slows down response time but is perfect for development
88
# since you don't have to restart the web server when you make code changes.
9-
config.cache_classes = false
9+
config.enable_reloading = true
1010

1111
# Do not eager load code on boot.
1212
config.eager_load = false
@@ -47,21 +47,17 @@
4747
# Tell Active Support which deprecation messages to disallow.
4848
config.active_support.disallowed_deprecation_warnings = []
4949

50-
# Suppress logger output for asset requests.
51-
# config.assets.quiet = true
50+
# Highlight code that enqueued background job in logs.
51+
config.active_job.verbose_enqueue_logs = true
5252

5353
# Raises error for missing translations.
5454
# config.i18n.raise_on_missing_translations = true
5555

5656
# Annotate rendered view with file names.
5757
# config.action_view.annotate_rendered_view_with_filenames = true
5858

59-
# Use an evented file watcher to asynchronously detect changes in source code,
60-
# routes, locales, etc. This feature depends on the listen gem.
61-
config.file_watcher = ActiveSupport::EventedFileUpdateChecker
62-
63-
# Uncomment if you wish to allow Action Cable access from any origin.
64-
# config.action_cable.disable_request_forgery_protection = true
59+
# Raise error when a before_action's only/except options reference missing actions
60+
config.action_controller.raise_on_missing_callback_actions = true
6561

6662
# Allow requests for all domains e.g. <app>.dev.gov.uk
6763
config.hosts.clear

config/environments/production.rb

Lines changed: 22 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
# Settings specified here will take precedence over those in config/application.rb.
55

66
# Code is not reloaded between requests.
7-
config.cache_classes = true
7+
config.enable_reloading = false
88

99
# Eager load code on boot. This eager loads most of Rails and
1010
# your application in memory, allowing both threaded web servers
@@ -16,39 +16,35 @@
1616
config.consider_all_requests_local = false
1717
config.action_controller.perform_caching = true
1818

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).
19+
# Ensures that a master key has been made available in ENV["RAILS_MASTER_KEY"], config/master.key, or an environment
20+
# key such as config/credentials/production.key. This key is used to decrypt credentials (and other encrypted files).
2121
# config.require_master_key = true
2222

23-
# Disable serving static files from the `/public` folder by default since
24-
# Apache or NGINX already handles this.
23+
# Enable static file serving from the `/public` folder (turn off if using NGINX/Apache for it).
2524
config.public_file_server.enabled = ENV["RAILS_SERVE_STATIC_FILES"].present?
2625

27-
# Compress JavaScripts and CSS.
28-
# config.assets.js_compressor = :uglifier
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-
3526
# Enable serving of images, stylesheets, and JavaScripts from an asset server.
3627
# config.asset_host = "http://assets.example.com"
3728

3829
# Specifies the header that your server uses for sending files.
3930
# config.action_dispatch.x_sendfile_header = "X-Sendfile" # for Apache
4031
# config.action_dispatch.x_sendfile_header = "X-Accel-Redirect" # for NGINX
4132

33+
# Assume all access to the app is happening through a SSL-terminating reverse proxy.
34+
# Can be used together with config.force_ssl for Strict-Transport-Security and secure cookies.
35+
# config.assume_ssl = true
36+
4237
# Force all access to the app over SSL, use Strict-Transport-Security, and use secure cookies.
4338
# config.force_ssl = true
4439

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 = ENV.fetch("RAILS_LOG_LEVEL", :info)
48-
4940
# Prepend all log lines with the following tags.
5041
config.log_tags = [:request_id]
5142

43+
# Info include generic and useful information about system operation, but avoids logging too much
44+
# information to avoid inadvertent exposure of personally identifiable information (PII). If you
45+
# want to log everything, set the level to "debug".
46+
config.log_level = ENV.fetch("RAILS_LOG_LEVEL", :info)
47+
5248
# Use a different cache store in production.
5349
# config.cache_store = :mem_cache_store
5450

@@ -66,21 +62,16 @@
6662
# the I18n.default_locale when a translation cannot be found).
6763
config.i18n.fallbacks = true
6864

69-
# Send deprecation notices to registered listeners.
70-
config.active_support.deprecation = :notify
71-
72-
# Log disallowed deprecations.
73-
config.active_support.disallowed_deprecation = :log
74-
75-
# Tell Active Support which deprecation messages to disallow.
76-
config.active_support.disallowed_deprecation_warnings = []
77-
78-
# Use default logging formatter so that PID and timestamp are not suppressed.
79-
config.log_formatter = ::Logger::Formatter.new
65+
# Don't log any deprecations.
66+
config.active_support.report_deprecations = false
8067

81-
# Use a different logger for distributed setups.
82-
# require "syslog/logger"
83-
# config.logger = ActiveSupport::TaggedLogging.new(Syslog::Logger.new "app-name")
68+
# Enable DNS rebinding protection and other `Host` header attacks.
69+
# config.hosts = [
70+
# "example.com", # Allow requests from example.com
71+
# /.*\.example\.com/ # Allow requests from subdomains like `www.example.com`
72+
# ]
73+
# Skip DNS rebinding protection for the default health check endpoint.
74+
# config.host_authorization = { exclude: ->(request) { request.path == "/up" } }
8475

8576
if ENV["RAILS_LOG_TO_STDOUT"].present?
8677
logger = ActiveSupport::Logger.new($stdout)

config/environments/test.rb

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -8,12 +8,13 @@
88
Rails.application.configure do
99
# Settings specified here will take precedence over those in config/application.rb.
1010

11-
# Turn false under Spring and add config.action_view.cache_template_loading = true.
12-
config.cache_classes = true
11+
# While tests run files are not watched, reloading is not necessary.
12+
config.enable_reloading = false
1313

14-
# Eager loading loads your whole application. When running a single test locally,
15-
# this probably isn't necessary. It's a good idea to do in a continuous integration
16-
# system, or in some way before deploying your code.
14+
# Eager loading loads your entire application. When running a single test locally,
15+
# this is usually not necessary, and can slow down your test suite. However, it's
16+
# recommended that you enable it in continuous integration systems to ensure eager
17+
# loading is working properly before deploying your code.
1718
config.eager_load = ENV["CI"].present?
1819

1920
# Configure public file server for tests with Cache-Control for performance.
@@ -28,7 +29,7 @@
2829
config.cache_store = :null_store
2930

3031
# Raise exceptions instead of rendering exception templates.
31-
config.action_dispatch.show_exceptions = false
32+
config.action_dispatch.show_exceptions = :none
3233

3334
# Enable request forgery protection in test environment.
3435
# This is so the tests fail if CSRF protection is enabled by default.
@@ -55,4 +56,7 @@
5556

5657
# Annotate rendered view with file names.
5758
# config.action_view.annotate_rendered_view_with_filenames = true
59+
60+
# Raise error when a before_action's only/except options reference missing actions
61+
config.action_controller.raise_on_missing_callback_actions = true
5862
end
Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
# Be sure to restart your server when you modify this file.
22

3-
# Define an application-wide content security policy
4-
# For further information see the following documentation
5-
# https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Content-Security-Policy
3+
# Define an application-wide content security policy.
4+
# See the Securing Rails Applications Guide for more information:
5+
# https://guides.rubyonrails.org/security.html#content-security-policy-header
66

77
# Rails.application.configure do
88
# config.content_security_policy do |policy|
@@ -16,11 +16,10 @@
1616
# # policy.report_uri "/csp-violation-report-endpoint"
1717
# end
1818
#
19-
# # Generate session nonces for permitted importmap and inline scripts
19+
# # Generate session nonces for permitted importmap, inline scripts, and inline styles.
2020
# config.content_security_policy_nonce_generator = ->(request) { request.session.id.to_s }
21-
# config.content_security_policy_nonce_directives = %w(script-src)
21+
# config.content_security_policy_nonce_directives = %w(script-src style-src)
2222
#
23-
# # Report CSP violations to a specified URI. See:
24-
# # https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Content-Security-Policy-Report-Only
23+
# # Report violations without enforcing the policy.
2524
# # config.content_security_policy_report_only = true
2625
# end
Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
# Be sure to restart your server when you modify this file.
22

3-
# Configure parameters to be filtered from the log file. Use this to limit dissemination of
4-
# sensitive information. See the ActiveSupport::ParameterFilter documentation for supported
5-
# notations and behaviors.
3+
# Configure parameters to be partially matched (e.g. passw matches password) and filtered from the log file.
4+
# Use this to limit dissemination of sensitive information.
5+
# See the ActiveSupport::ParameterFilter documentation for supported notations and behaviors.
66
Rails.application.config.filter_parameters += %i[
77
passw secret token _key crypt salt certificate otp ssn
88
]
Lines changed: 11 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,13 @@
1+
# Be sure to restart your server when you modify this file.
2+
13
# Define an application-wide HTTP permissions policy. For further
2-
# information see https://developers.google.com/web/updates/2018/06/feature-policy
3-
#
4-
# Rails.application.config.permissions_policy do |f|
5-
# f.camera :none
6-
# f.gyroscope :none
7-
# f.microphone :none
8-
# f.usb :none
9-
# f.fullscreen :self
10-
# f.payment :self, "https://secure.example.com"
4+
# information see: https://developers.google.com/web/updates/2018/06/feature-policy
5+
6+
# Rails.application.config.permissions_policy do |policy|
7+
# policy.camera :none
8+
# policy.gyroscope :none
9+
# policy.microphone :none
10+
# policy.usb :none
11+
# policy.fullscreen :self
12+
# policy.payment :self, "https://secure.example.com"
1113
# end

0 commit comments

Comments
 (0)