Browse Source

Rails 7 (#174)

* Rails 7 config

* Gem bumps

* Turn off unused rails engines

* Rails 7 released

* Rubocop

* Not currently using ActionCable
pull/175/head
baarkerlounger 3 years ago committed by GitHub
parent
commit
195c41eccc
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 9
      Gemfile
  2. 212
      Gemfile.lock
  3. 4
      app/channels/application_cable/channel.rb
  4. 4
      app/channels/application_cable/connection.rb
  5. 2
      bin/rails
  6. 0
      bin/rake
  7. 21
      bin/setup
  8. 0
      bin/webpack
  9. 0
      bin/webpack-dev-server
  10. 0
      bin/yarn
  11. 11
      config/application.rb
  12. 7
      config/environments/development.rb
  13. 32
      config/environments/production.rb
  14. 11
      config/environments/test.rb
  15. 42
      config/initializers/content_security_policy.rb
  16. 8
      config/initializers/inflections.rb

9
Gemfile

@ -6,7 +6,7 @@ git_source(:github) { |repo| "https://github.com/#{repo}.git" }
ruby "3.0.2" ruby "3.0.2"
# Bundle edge Rails instead: gem 'rails', github: 'rails/rails', branch: 'main' # Bundle edge Rails instead: gem 'rails', github: 'rails/rails', branch: 'main'
gem "rails", "~> 6.1.4" gem "rails", "~> 7.0.0"
# Use postgresql as the database for Active Record # Use postgresql as the database for Active Record
gem "pg", "~> 1.1" gem "pg", "~> 1.1"
# Use Puma as the app server # Use Puma as the app server
@ -24,7 +24,9 @@ gem "hotwire-rails"
# Soft delete ActiveRecords objects # Soft delete ActiveRecords objects
gem "discard" gem "discard"
# Administration framework # Administration framework
gem "activeadmin" gem "activeadmin", git: "https://github.com/naveed-ahmad/activeadmin.git", branch: "rails7"
gem "inherited_resources", git: "https://github.com/naveed-ahmad/inherited_resources.git", branch: "rails7"
gem "ransack", github: "activerecord-hackery/ransack"
# Admin charts # Admin charts
gem "chartkick" gem "chartkick"
# Spreadsheet parsing # Spreadsheet parsing
@ -36,8 +38,9 @@ gem "json-schema"
gem "devise", github: "ghiculescu/devise", branch: "error-code-422" gem "devise", github: "ghiculescu/devise", branch: "error-code-422"
# UK postcode parsing and validation # UK postcode parsing and validation
gem "uk_postcode" gem "uk_postcode"
# Use Ruby objects to build reusable markup. A React inspired evolution of the presenter pattern # Get rich data from postcode lookups. Wraps postcodes.io
gem "postcodes_io" gem "postcodes_io"
# Use Ruby objects to build reusable markup. A React inspired evolution of the presenter pattern
gem "view_component" gem "view_component"
group :development, :test do group :development, :test do

212
Gemfile.lock

@ -1,3 +1,12 @@
GIT
remote: https://github.com/activerecord-hackery/ransack.git
revision: 25c5c9dfec216a5fafcd90b8893abcfe19460e50
specs:
ransack (2.4.2)
activerecord (>= 5.2.4)
activesupport (>= 5.2.4)
i18n
GIT GIT
remote: https://github.com/ghiculescu/devise.git remote: https://github.com/ghiculescu/devise.git
revision: 3b2d9ae3d47be5c9228c4446119b04b0e98917c1 revision: 3b2d9ae3d47be5c9228c4446119b04b0e98917c1
@ -10,9 +19,35 @@ GIT
responders responders
warden (~> 1.2.3) warden (~> 1.2.3)
GIT
remote: https://github.com/naveed-ahmad/activeadmin.git
revision: 669d808151d8a087ccdd8dad7ebac303289873de
branch: rails7
specs:
activeadmin (2.9.0)
arbre (~> 1.2, >= 1.2.1)
formtastic (>= 3.1, < 5.0)
formtastic_i18n (~> 0.4)
inherited_resources (~> 1.7)
jquery-rails (~> 4.2)
kaminari (~> 1.0, >= 1.2.1)
railties (>= 5.2, <= 7.0.0)
ransack (~> 2.1, >= 2.1.1)
GIT
remote: https://github.com/naveed-ahmad/inherited_resources.git
revision: 15aa6273f97cc34369a080b82e7b9e15c4308c00
branch: rails7
specs:
inherited_resources (1.13.0)
actionpack (>= 5.2, <= 7.0.0)
has_scope (~> 0.6)
railties (>= 5.2, <= 7.0.0)
responders (>= 2, < 4)
GIT GIT
remote: https://github.com/rspec/rspec-core.git remote: https://github.com/rspec/rspec-core.git
revision: e36aa2a9ebe68acee3ce05190fc2124947b45925 revision: e3bda9da1e625a428fd005f0d1a633531f5da749
branch: main branch: main
specs: specs:
rspec-core (3.11.0.pre) rspec-core (3.11.0.pre)
@ -20,7 +55,7 @@ GIT
GIT GIT
remote: https://github.com/rspec/rspec-expectations.git remote: https://github.com/rspec/rspec-expectations.git
revision: dba67987c63f551d1bf0f7877f069fa8b72d0461 revision: d9fd9a5589e3914bcd25d66560eccadd75493727
branch: main branch: main
specs: specs:
rspec-expectations (3.11.0.pre) rspec-expectations (3.11.0.pre)
@ -38,7 +73,7 @@ GIT
GIT GIT
remote: https://github.com/rspec/rspec-rails.git remote: https://github.com/rspec/rspec-rails.git
revision: 5f54d780a3d8f21cfe4f424a7d0435be2e279356 revision: 24631bfc78fc0bd69d66ab8eb7f81731bd789bbc
branch: main branch: main
specs: specs:
rspec-rails (5.1.0.pre) rspec-rails (5.1.0.pre)
@ -60,79 +95,69 @@ GIT
GEM GEM
remote: https://rubygems.org/ remote: https://rubygems.org/
specs: specs:
actioncable (6.1.4.1) actioncable (7.0.0)
actionpack (= 6.1.4.1) actionpack (= 7.0.0)
activesupport (= 6.1.4.1) activesupport (= 7.0.0)
nio4r (~> 2.0) nio4r (~> 2.0)
websocket-driver (>= 0.6.1) websocket-driver (>= 0.6.1)
actionmailbox (6.1.4.1) actionmailbox (7.0.0)
actionpack (= 6.1.4.1) actionpack (= 7.0.0)
activejob (= 6.1.4.1) activejob (= 7.0.0)
activerecord (= 6.1.4.1) activerecord (= 7.0.0)
activestorage (= 6.1.4.1) activestorage (= 7.0.0)
activesupport (= 6.1.4.1) activesupport (= 7.0.0)
mail (>= 2.7.1) mail (>= 2.7.1)
actionmailer (6.1.4.1) actionmailer (7.0.0)
actionpack (= 6.1.4.1) actionpack (= 7.0.0)
actionview (= 6.1.4.1) actionview (= 7.0.0)
activejob (= 6.1.4.1) activejob (= 7.0.0)
activesupport (= 6.1.4.1) activesupport (= 7.0.0)
mail (~> 2.5, >= 2.5.4) mail (~> 2.5, >= 2.5.4)
rails-dom-testing (~> 2.0) rails-dom-testing (~> 2.0)
actionpack (6.1.4.1) actionpack (7.0.0)
actionview (= 6.1.4.1) actionview (= 7.0.0)
activesupport (= 6.1.4.1) activesupport (= 7.0.0)
rack (~> 2.0, >= 2.0.9) rack (~> 2.0, >= 2.2.0)
rack-test (>= 0.6.3) rack-test (>= 0.6.3)
rails-dom-testing (~> 2.0) rails-dom-testing (~> 2.0)
rails-html-sanitizer (~> 1.0, >= 1.2.0) rails-html-sanitizer (~> 1.0, >= 1.2.0)
actiontext (6.1.4.1) actiontext (7.0.0)
actionpack (= 6.1.4.1) actionpack (= 7.0.0)
activerecord (= 6.1.4.1) activerecord (= 7.0.0)
activestorage (= 6.1.4.1) activestorage (= 7.0.0)
activesupport (= 6.1.4.1) activesupport (= 7.0.0)
globalid (>= 0.6.0)
nokogiri (>= 1.8.5) nokogiri (>= 1.8.5)
actionview (6.1.4.1) actionview (7.0.0)
activesupport (= 6.1.4.1) activesupport (= 7.0.0)
builder (~> 3.1) builder (~> 3.1)
erubi (~> 1.4) erubi (~> 1.4)
rails-dom-testing (~> 2.0) rails-dom-testing (~> 2.0)
rails-html-sanitizer (~> 1.1, >= 1.2.0) rails-html-sanitizer (~> 1.1, >= 1.2.0)
activeadmin (2.9.0) activejob (7.0.0)
arbre (~> 1.2, >= 1.2.1) activesupport (= 7.0.0)
formtastic (>= 3.1, < 5.0)
formtastic_i18n (~> 0.4)
inherited_resources (~> 1.7)
jquery-rails (~> 4.2)
kaminari (~> 1.0, >= 1.2.1)
railties (>= 5.2, < 6.2)
ransack (~> 2.1, >= 2.1.1)
activejob (6.1.4.1)
activesupport (= 6.1.4.1)
globalid (>= 0.3.6) globalid (>= 0.3.6)
activemodel (6.1.4.1) activemodel (7.0.0)
activesupport (= 6.1.4.1) activesupport (= 7.0.0)
activerecord (6.1.4.1) activerecord (7.0.0)
activemodel (= 6.1.4.1) activemodel (= 7.0.0)
activesupport (= 6.1.4.1) activesupport (= 7.0.0)
activestorage (6.1.4.1) activestorage (7.0.0)
actionpack (= 6.1.4.1) actionpack (= 7.0.0)
activejob (= 6.1.4.1) activejob (= 7.0.0)
activerecord (= 6.1.4.1) activerecord (= 7.0.0)
activesupport (= 6.1.4.1) activesupport (= 7.0.0)
marcel (~> 1.0.0) marcel (~> 1.0)
mini_mime (>= 1.1.0) mini_mime (>= 1.1.0)
activesupport (6.1.4.1) activesupport (7.0.0)
concurrent-ruby (~> 1.0, >= 1.0.2) concurrent-ruby (~> 1.0, >= 1.0.2)
i18n (>= 1.6, < 2) i18n (>= 1.6, < 2)
minitest (>= 5.1) minitest (>= 5.1)
tzinfo (~> 2.0) tzinfo (~> 2.0)
zeitwerk (~> 2.3)
addressable (2.8.0) addressable (2.8.0)
public_suffix (>= 2.0.2, < 5.0) public_suffix (>= 2.0.2, < 5.0)
arbre (1.4.0) arbre (1.2.1)
activesupport (>= 3.0.0, < 6.2) activesupport (>= 3.0.0)
ruby2_keywords (>= 0.0.2, < 1.0)
ast (2.4.2) ast (2.4.2)
bcrypt (3.1.16) bcrypt (3.1.16)
bindex (0.8.1) bindex (0.8.1)
@ -163,8 +188,8 @@ GEM
crass (1.0.6) crass (1.0.6)
deep_merge (1.2.1) deep_merge (1.2.1)
diff-lcs (1.4.4) diff-lcs (1.4.4)
discard (1.2.0) discard (1.2.1)
activerecord (>= 4.2, < 7) activerecord (>= 4.2, < 8)
docile (1.4.0) docile (1.4.0)
dotenv (2.7.6) dotenv (2.7.6)
dotenv-rails (2.7.6) dotenv-rails (2.7.6)
@ -202,11 +227,6 @@ GEM
turbo-rails turbo-rails
i18n (1.8.11) i18n (1.8.11)
concurrent-ruby (~> 1.0) concurrent-ruby (~> 1.0)
inherited_resources (1.13.0)
actionpack (>= 5.2, < 6.2)
has_scope (~> 0.6)
railties (>= 5.2, < 6.2)
responders (>= 2, < 4)
iniparse (1.5.0) iniparse (1.5.0)
jquery-rails (4.4.0) jquery-rails (4.4.0)
rails-dom-testing (>= 1, < 3) rails-dom-testing (>= 1, < 3)
@ -229,7 +249,7 @@ GEM
listen (3.7.0) listen (3.7.0)
rb-fsevent (~> 0.10, >= 0.10.3) rb-fsevent (~> 0.10, >= 0.10.3)
rb-inotify (~> 0.9, >= 0.9.10) rb-inotify (~> 0.9, >= 0.9.10)
loofah (2.12.0) loofah (2.13.0)
crass (~> 1.0.2) crass (~> 1.0.2)
nokogiri (>= 1.5.9) nokogiri (>= 1.5.9)
mail (2.7.1) mail (2.7.1)
@ -238,7 +258,7 @@ GEM
matrix (0.4.2) matrix (0.4.2)
method_source (1.0.0) method_source (1.0.0)
mini_mime (1.1.2) mini_mime (1.1.2)
minitest (5.14.4) minitest (5.15.0)
msgpack (1.4.2) msgpack (1.4.2)
nio4r (2.5.8) nio4r (2.5.8)
nokogiri (1.12.5-arm64-darwin) nokogiri (1.12.5-arm64-darwin)
@ -253,7 +273,7 @@ GEM
iniparse (~> 1.4) iniparse (~> 1.4)
rexml (~> 3.2) rexml (~> 3.2)
parallel (1.21.0) parallel (1.21.0)
parser (3.0.3.1) parser (3.0.3.2)
ast (~> 2.4.1) ast (~> 2.4.1)
pg (1.2.3) pg (1.2.3)
postcodes_io (0.4.0) postcodes_io (0.4.0)
@ -275,38 +295,34 @@ GEM
rack rack
rack-test (1.1.0) rack-test (1.1.0)
rack (>= 1.0, < 3) rack (>= 1.0, < 3)
rails (6.1.4.1) rails (7.0.0)
actioncable (= 6.1.4.1) actioncable (= 7.0.0)
actionmailbox (= 6.1.4.1) actionmailbox (= 7.0.0)
actionmailer (= 6.1.4.1) actionmailer (= 7.0.0)
actionpack (= 6.1.4.1) actionpack (= 7.0.0)
actiontext (= 6.1.4.1) actiontext (= 7.0.0)
actionview (= 6.1.4.1) actionview (= 7.0.0)
activejob (= 6.1.4.1) activejob (= 7.0.0)
activemodel (= 6.1.4.1) activemodel (= 7.0.0)
activerecord (= 6.1.4.1) activerecord (= 7.0.0)
activestorage (= 6.1.4.1) activestorage (= 7.0.0)
activesupport (= 6.1.4.1) activesupport (= 7.0.0)
bundler (>= 1.15.0) bundler (>= 1.15.0)
railties (= 6.1.4.1) railties (= 7.0.0)
sprockets-rails (>= 2.0.0)
rails-dom-testing (2.0.3) rails-dom-testing (2.0.3)
activesupport (>= 4.2.0) activesupport (>= 4.2.0)
nokogiri (>= 1.6) nokogiri (>= 1.6)
rails-html-sanitizer (1.4.2) rails-html-sanitizer (1.4.2)
loofah (~> 2.3) loofah (~> 2.3)
railties (6.1.4.1) railties (7.0.0)
actionpack (= 6.1.4.1) actionpack (= 7.0.0)
activesupport (= 6.1.4.1) activesupport (= 7.0.0)
method_source method_source
rake (>= 0.13) rake (>= 12.2)
thor (~> 1.0) thor (~> 1.0)
zeitwerk (~> 2.5)
rainbow (3.0.0) rainbow (3.0.0)
rake (13.0.6) rake (13.0.6)
ransack (2.4.2)
activerecord (>= 5.2.4)
activesupport (>= 5.2.4)
i18n
rb-fsevent (0.11.0) rb-fsevent (0.11.0)
rb-inotify (0.10.1) rb-inotify (0.10.1)
ffi (~> 1.0) ffi (~> 1.0)
@ -369,18 +385,12 @@ GEM
simplecov_json_formatter (~> 0.1) simplecov_json_formatter (~> 0.1)
simplecov-html (0.12.3) simplecov-html (0.12.3)
simplecov_json_formatter (0.1.3) simplecov_json_formatter (0.1.3)
sprockets (4.0.2) stimulus-rails (1.0.2)
concurrent-ruby (~> 1.0) railties (>= 6.0.0)
rack (> 1, < 3)
sprockets-rails (3.4.1)
actionpack (>= 5.2)
activesupport (>= 5.2)
sprockets (>= 3.0.0)
stimulus-rails (0.7.3)
rails (>= 6.0.0)
thor (1.1.0) thor (1.1.0)
turbo-rails (0.9.0) turbo-rails (1.0.0)
rails (>= 6.0.0) actionpack (>= 6.0.0)
railties (>= 6.0.0)
tzinfo (2.0.4) tzinfo (2.0.4)
concurrent-ruby (~> 1.0) concurrent-ruby (~> 1.0)
uk_postcode (2.1.7) uk_postcode (2.1.7)
@ -418,7 +428,7 @@ PLATFORMS
x86_64-linux x86_64-linux
DEPENDENCIES DEPENDENCIES
activeadmin activeadmin!
bootsnap (>= 1.4.4) bootsnap (>= 1.4.4)
byebug byebug
capybara capybara
@ -431,6 +441,7 @@ DEPENDENCIES
govuk-components govuk-components
govuk_design_system_formbuilder govuk_design_system_formbuilder
hotwire-rails hotwire-rails
inherited_resources!
json-schema json-schema
listen (~> 3.3) listen (~> 3.3)
overcommit (>= 0.37.0) overcommit (>= 0.37.0)
@ -439,7 +450,8 @@ DEPENDENCIES
pry-byebug pry-byebug
puma (~> 5.0) puma (~> 5.0)
rack-mini-profiler (~> 2.0) rack-mini-profiler (~> 2.0)
rails (~> 6.1.4) rails (~> 7.0.0)
ransack!
roo roo
rspec-core! rspec-core!
rspec-expectations! rspec-expectations!

4
app/channels/application_cable/channel.rb

@ -1,4 +0,0 @@
module ApplicationCable
class Channel < ActionCable::Channel::Base
end
end

4
app/channels/application_cable/connection.rb

@ -1,4 +0,0 @@
module ApplicationCable
class Connection < ActionCable::Connection::Base
end
end

2
bin/rails

@ -1,4 +1,4 @@
#!/usr/bin/env ruby #!/usr/bin/env ruby
APP_PATH = File.expand_path('../config/application', __dir__) APP_PATH = File.expand_path("../config/application", __dir__)
require_relative "../config/boot" require_relative "../config/boot"
require "rails/commands" require "rails/commands"

21
bin/setup

@ -2,7 +2,7 @@
require "fileutils" require "fileutils"
# path to your application root. # path to your application root.
APP_ROOT = File.expand_path('..', __dir__) APP_ROOT = File.expand_path("..", __dir__)
def system!(*args) def system!(*args)
system(*args) || abort("\n== Command #{args} failed ==") system(*args) || abort("\n== Command #{args} failed ==")
@ -13,24 +13,21 @@ FileUtils.chdir APP_ROOT do
# This script is idempotent, so that you can run it at any time and get an expectable outcome. # This script is idempotent, so that you can run it at any time and get an expectable outcome.
# Add necessary setup steps to this file. # Add necessary setup steps to this file.
puts '== Installing dependencies ==' puts "== Installing dependencies =="
system! 'gem install bundler --conservative' system! "gem install bundler --conservative"
system('bundle check') || system!('bundle install') system("bundle check") || system!("bundle install")
# Install JavaScript dependencies
system! 'bin/yarn'
# puts "\n== Copying sample files ==" # puts "\n== Copying sample files =="
# unless File.exist?('config/database.yml') # unless File.exist?("config/database.yml")
# FileUtils.cp 'config/database.yml.sample', 'config/database.yml' # FileUtils.cp "config/database.yml.sample", "config/database.yml"
# end # end
puts "\n== Preparing database ==" puts "\n== Preparing database =="
system! 'bin/rails db:prepare' system! "bin/rails db:prepare"
puts "\n== Removing old logs and tempfiles ==" puts "\n== Removing old logs and tempfiles =="
system! 'bin/rails log:clear tmp:clear' system! "bin/rails log:clear tmp:clear"
puts "\n== Restarting application server ==" puts "\n== Restarting application server =="
system! 'bin/rails restart' system! "bin/rails restart"
end end

0
bin/webpack

0
bin/webpack-dev-server

11
config/application.rb

@ -5,13 +5,13 @@ require "rails"
require "active_model/railtie" require "active_model/railtie"
require "active_job/railtie" require "active_job/railtie"
require "active_record/railtie" require "active_record/railtie"
require "active_storage/engine" # require "active_storage/engine"
require "action_controller/railtie" require "action_controller/railtie"
require "action_mailer/railtie" require "action_mailer/railtie"
require "action_mailbox/engine" require "action_mailbox/engine"
require "action_text/engine" # require "action_text/engine"
require "action_view/railtie" require "action_view/railtie"
require "action_cable/engine" # require "action_cable/engine"
# require "sprockets/railtie" # require "sprockets/railtie"
# require "rails/test_unit/railtie" # require "rails/test_unit/railtie"
@ -22,7 +22,7 @@ Bundler.require(*Rails.groups)
module DataCollector module DataCollector
class Application < Rails::Application class Application < Rails::Application
# Initialize configuration defaults for originally generated Rails version. # Initialize configuration defaults for originally generated Rails version.
config.load_defaults 6.1 config.load_defaults 7.0
# Configuration for the application, engines, and railties goes here. # Configuration for the application, engines, and railties goes here.
# #
@ -31,8 +31,5 @@ module DataCollector
# #
config.time_zone = "London" config.time_zone = "London"
# config.eager_load_paths << Rails.root.join("extras") # config.eager_load_paths << Rails.root.join("extras")
# Don't generate system test files.
config.generators.system_tests = nil
end end
end end

7
config/environments/development.rb

@ -14,6 +14,9 @@ Rails.application.configure do
# Show full error reports. # Show full error reports.
config.consider_all_requests_local = true config.consider_all_requests_local = true
# Enable server timing
config.server_timing = true
# Enable/disable caching. By default caching is disabled. # Enable/disable caching. By default caching is disabled.
# Run rails dev:cache to toggle caching. # Run rails dev:cache to toggle caching.
if Rails.root.join("tmp/caching-dev.txt").exist? if Rails.root.join("tmp/caching-dev.txt").exist?
@ -75,10 +78,6 @@ Rails.application.configure do
# Annotate rendered view with file names. # Annotate rendered view with file names.
# config.action_view.annotate_rendered_view_with_filenames = true # config.action_view.annotate_rendered_view_with_filenames = true
# Use an evented file watcher to asynchronously detect changes in source code,
# routes, locales, etc. This feature depends on the listen gem.
config.file_watcher = ActiveSupport::EventedFileUpdateChecker
# Uncomment if you wish to allow Action Cable access from any origin. # Uncomment if you wish to allow Action Cable access from any origin.
# config.action_cable.disable_request_forgery_protection = true # config.action_cable.disable_request_forgery_protection = true
end end

32
config/environments/production.rb

@ -25,19 +25,19 @@ Rails.application.configure do
config.public_file_server.enabled = ENV["RAILS_SERVE_STATIC_FILES"].present? config.public_file_server.enabled = ENV["RAILS_SERVE_STATIC_FILES"].present?
# Enable serving of images, stylesheets, and JavaScripts from an asset server. # Enable serving of images, stylesheets, and JavaScripts from an asset server.
# config.asset_host = 'http://assets.example.com' # config.asset_host = "http://assets.example.com"
# Specifies the header that your server uses for sending files. # Specifies the header that your server uses for sending files.
# config.action_dispatch.x_sendfile_header = 'X-Sendfile' # for Apache # config.action_dispatch.x_sendfile_header = "X-Sendfile" # for Apache
# config.action_dispatch.x_sendfile_header = 'X-Accel-Redirect' # for NGINX # config.action_dispatch.x_sendfile_header = "X-Accel-Redirect" # for NGINX
# Store uploaded files on the local file system (see config/storage.yml for options). # Store uploaded files on the local file system (see config/storage.yml for options).
config.active_storage.service = :local config.active_storage.service = :local
# Mount Action Cable outside main process or domain. # Mount Action Cable outside main process or domain.
# config.action_cable.mount_path = nil # config.action_cable.mount_path = nil
# config.action_cable.url = 'wss://example.com/cable' # config.action_cable.url = "wss://example.com/cable"
# config.action_cable.allowed_request_origins = [ 'http://example.com', /http:\/\/example.*/ ] # config.action_cable.allowed_request_origins = [ "http://example.com", /http:\/\/example.*/ ]
# Force all access to the app over SSL, use Strict-Transport-Security, and use secure cookies. # Force all access to the app over SSL, use Strict-Transport-Security, and use secure cookies.
# config.force_ssl = true # config.force_ssl = true
@ -79,21 +79,15 @@ Rails.application.configure do
# the I18n.default_locale when a translation cannot be found). # the I18n.default_locale when a translation cannot be found).
config.i18n.fallbacks = true config.i18n.fallbacks = true
# Send deprecation notices to registered listeners. # Don't log any deprecations.
config.active_support.deprecation = :notify config.active_support.report_deprecations = false
# Log disallowed deprecations.
config.active_support.disallowed_deprecation = :log
# Tell Active Support which deprecation messages to disallow.
config.active_support.disallowed_deprecation_warnings = []
# Use default logging formatter so that PID and timestamp are not suppressed. # Use default logging formatter so that PID and timestamp are not suppressed.
config.log_formatter = ::Logger::Formatter.new config.log_formatter = ::Logger::Formatter.new
# Use a different logger for distributed setups. # Use a different logger for distributed setups.
# require "syslog/logger" # require "syslog/logger"
# config.logger = ActiveSupport::TaggedLogging.new(Syslog::Logger.new 'app-name') # config.logger = ActiveSupport::TaggedLogging.new(Syslog::Logger.new "app-name")
if ENV["RAILS_LOG_TO_STDOUT"].present? if ENV["RAILS_LOG_TO_STDOUT"].present?
logger = ActiveSupport::Logger.new($stdout) logger = ActiveSupport::Logger.new($stdout)
@ -124,4 +118,14 @@ Rails.application.configure do
# config.active_record.database_selector = { delay: 2.seconds } # config.active_record.database_selector = { delay: 2.seconds }
# config.active_record.database_resolver = ActiveRecord::Middleware::DatabaseSelector::Resolver # config.active_record.database_resolver = ActiveRecord::Middleware::DatabaseSelector::Resolver
# config.active_record.database_resolver_context = ActiveRecord::Middleware::DatabaseSelector::Resolver::Session # config.active_record.database_resolver_context = ActiveRecord::Middleware::DatabaseSelector::Resolver::Session
# Inserts middleware to perform automatic shard swapping. The `shard_selector` hash
# can be used to pass options to the `ShardSelector` middleware. The `lock` option is
# used to determine whether shard swapping should be prohibited for the request.
#
# The `shard_resolver` option is used by the middleware to determine which shard
# to switch to. The application must provide a mechanism for finding the shard name
# in a proc. See guides for an example.
# config.active_record.shard_selector = { lock: true }
# config.active_record.shard_resolver = ->(request) { Tenant.find_by!(host: request.host).shard }
end end

11
config/environments/test.rb

@ -8,12 +8,13 @@ require "active_support/core_ext/integer/time"
Rails.application.configure do Rails.application.configure do
# Settings specified here will take precedence over those in config/application.rb. # Settings specified here will take precedence over those in config/application.rb.
# Turn false under Spring and add config.action_view.cache_template_loading = true
config.cache_classes = true config.cache_classes = true
# Do not eager load code on boot. This avoids loading your whole application # Eager loading loads your whole application. When running a single test locally,
# just for the purpose of running a single test. If you are using a tool that # this probably isn't necessary. It's a good idea to do in a continuous integration
# preloads Rails for running tests, you may have to set it to true. # system, or in some way before deploying your code.
config.eager_load = false config.eager_load = ENV["CI"].present?
# Configure public file server for tests with Cache-Control for performance. # Configure public file server for tests with Cache-Control for performance.
config.public_file_server.enabled = true config.public_file_server.enabled = true
@ -38,12 +39,12 @@ Rails.application.configure do
config.action_mailer.perform_caching = false config.action_mailer.perform_caching = false
config.action_mailer.default_url_options = { host: "localhost", port: 3000 } config.action_mailer.default_url_options = { host: "localhost", port: 3000 }
config.action_mailer.default_options = { from: "test@gmail.com" }
# Tell Action Mailer not to deliver emails to the real world. # Tell Action Mailer not to deliver emails to the real world.
# The :test delivery method accumulates sent emails in the # The :test delivery method accumulates sent emails in the
# ActionMailer::Base.deliveries array. # ActionMailer::Base.deliveries array.
config.action_mailer.delivery_method = :test config.action_mailer.delivery_method = :test
config.action_mailer.default_options = { from: "test@gmail.com" }
# Print deprecation notices to the stderr. # Print deprecation notices to the stderr.
config.active_support.deprecation = :stderr config.active_support.deprecation = :stderr

42
config/initializers/content_security_policy.rb

@ -4,27 +4,23 @@
# For further information see the following documentation # For further information see the following documentation
# https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Content-Security-Policy # https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Content-Security-Policy
# Rails.application.config.content_security_policy do |policy| # Rails.application.configure do
# policy.default_src :self, :https # config.content_security_policy do |policy|
# policy.font_src :self, :https, :data # policy.default_src :self, :https
# policy.img_src :self, :https, :data # policy.font_src :self, :https, :data
# policy.object_src :none # policy.img_src :self, :https, :data
# policy.script_src :self, :https # policy.object_src :none
# policy.style_src :self, :https # policy.script_src :self, :https
# # If you are using webpack-dev-server then specify webpack-dev-server host # policy.style_src :self, :https
# policy.connect_src :self, :https, "http://localhost:3035", "ws://localhost:3035" if Rails.env.development? # # Specify URI for violation reports
# # policy.report_uri "/csp-violation-report-endpoint"
# # Specify URI for violation reports # end
# # policy.report_uri "/csp-violation-report-endpoint" #
# # Generate session nonces for permitted importmap and inline scripts
# config.content_security_policy_nonce_generator = ->(request) { request.session.id.to_s }
# config.content_security_policy_nonce_directives = %w(script-src)
#
# # Report CSP violations to a specified URI. See:
# # https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Content-Security-Policy-Report-Only
# # config.content_security_policy_report_only = true
# end # end
# If you are using UJS then enable automatic nonce generation
# Rails.application.config.content_security_policy_nonce_generator = -> request { SecureRandom.base64(16) }
# Set the nonce only to specific directives
# Rails.application.config.content_security_policy_nonce_directives = %w(script-src)
# Report CSP violations to a specified URI
# For further information see the following documentation:
# https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Content-Security-Policy-Report-Only
# Rails.application.config.content_security_policy_report_only = true

8
config/initializers/inflections.rb

@ -4,13 +4,13 @@
# are locale specific, and you may define rules for as many different # are locale specific, and you may define rules for as many different
# locales as you wish. All of these examples are active by default: # locales as you wish. All of these examples are active by default:
# ActiveSupport::Inflector.inflections(:en) do |inflect| # ActiveSupport::Inflector.inflections(:en) do |inflect|
# inflect.plural /^(ox)$/i, '\1en' # inflect.plural /^(ox)$/i, "\\1en"
# inflect.singular /^(ox)en/i, '\1' # inflect.singular /^(ox)en/i, "\\1"
# inflect.irregular 'person', 'people' # inflect.irregular "person", "people"
# inflect.uncountable %w( fish sheep ) # inflect.uncountable %w( fish sheep )
# end # end
# These inflection rules are supported but not enabled by default: # These inflection rules are supported but not enabled by default:
# ActiveSupport::Inflector.inflections(:en) do |inflect| # ActiveSupport::Inflector.inflections(:en) do |inflect|
# inflect.acronym 'RESTful' # inflect.acronym "RESTful"
# end # end

Loading…
Cancel
Save