Skip to content

Commit 547acb8

Browse files
authored
Merge pull request #873 from alphagov/revert-871-rails-7.1
Revert "Upgrade to Rails 7.1"
2 parents 0f3423c + 6b4d392 commit 547acb8

File tree

7 files changed

+67
-65
lines changed

7 files changed

+67
-65
lines changed

config/application.rb

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -18,15 +18,10 @@
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.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])
24+
config.load_defaults 7.0
3025

3126
# Configuration for the application, engines, and railties goes here.
3227
#
@@ -35,7 +30,6 @@ class Application < Rails::Application
3530
#
3631
# config.time_zone = "Central Time (US & Canada)"
3732
# config.eager_load_paths << Rails.root.join("extras")
38-
3933
config.middleware.insert_after(Rack::Runtime, Rack::MethodOverride)
4034
end
4135
end

config/environments/development.rb

Lines changed: 9 additions & 5 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.enable_reloading = true
9+
config.cache_classes = false
1010

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

50-
# Highlight code that enqueued background job in logs.
51-
config.active_job.verbose_enqueue_logs = true
50+
# Suppress logger output for asset requests.
51+
# config.assets.quiet = 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-
# Raise error when a before_action's only/except options reference missing actions
60-
config.action_controller.raise_on_missing_callback_actions = true
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
6165

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

config/environments/production.rb

Lines changed: 31 additions & 22 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.enable_reloading = false
7+
config.cache_classes = true
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,35 +16,39 @@
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 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).
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).
2121
# config.require_master_key = true
2222

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

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+
2635
# Enable serving of images, stylesheets, and JavaScripts from an asset server.
2736
# config.asset_host = "http://assets.example.com"
2837

2938
# Specifies the header that your server uses for sending files.
3039
# config.action_dispatch.x_sendfile_header = "X-Sendfile" # for Apache
3140
# config.action_dispatch.x_sendfile_header = "X-Accel-Redirect" # for NGINX
3241

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-
3742
# Force all access to the app over SSL, use Strict-Transport-Security, and use secure cookies.
3843
# config.force_ssl = true
3944

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+
4049
# Prepend all log lines with the following tags.
4150
config.log_tags = [:request_id]
4251

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-
4852
# Use a different cache store in production.
4953
# config.cache_store = :mem_cache_store
5054

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

65-
# Don't log any deprecations.
66-
config.active_support.report_deprecations = false
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
6780

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" } }
81+
# Use a different logger for distributed setups.
82+
# require "syslog/logger"
83+
# config.logger = ActiveSupport::TaggedLogging.new(Syslog::Logger.new "app-name")
7584

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

config/environments/test.rb

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

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

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.
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.
1817
config.eager_load = ENV["CI"].present?
1918

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

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

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

5756
# Annotate rendered view with file names.
5857
# 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
6258
end
Lines changed: 7 additions & 6 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-
# See the Securing Rails Applications Guide for more information:
5-
# https://guides.rubyonrails.org/security.html#content-security-policy-header
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
66

77
# Rails.application.configure do
88
# config.content_security_policy do |policy|
@@ -16,10 +16,11 @@
1616
# # policy.report_uri "/csp-violation-report-endpoint"
1717
# end
1818
#
19-
# # Generate session nonces for permitted importmap, inline scripts, and inline styles.
19+
# # Generate session nonces for permitted importmap and inline scripts
2020
# config.content_security_policy_nonce_generator = ->(request) { request.session.id.to_s }
21-
# config.content_security_policy_nonce_directives = %w(script-src style-src)
21+
# config.content_security_policy_nonce_directives = %w(script-src)
2222
#
23-
# # Report violations without enforcing the policy.
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
2425
# # config.content_security_policy_report_only = true
2526
# 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 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.
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.
66
Rails.application.config.filter_parameters += %i[
77
passw secret token _key crypt salt certificate otp ssn
88
]
Lines changed: 9 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,11 @@
1-
# Be sure to restart your server when you modify this file.
2-
31
# Define an application-wide HTTP permissions policy. For further
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"
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"
1311
# end

0 commit comments

Comments
 (0)