diff options
author | Benjamin Neff <benjamin@coding4coffee.ch> | 2022-07-17 03:09:38 +0300 |
---|---|---|
committer | Benjamin Neff <benjamin@coding4coffee.ch> | 2022-07-20 22:27:41 +0300 |
commit | fe84d3e1017132790b4b4206562857eccafe4a10 (patch) | |
tree | 9f95f8c0a4336ed7d081f76cede8fcdcf568e58c /config | |
parent | 1ef3c83a0a6fccecc4336812e8ef8e0b817d0c57 (diff) |
Upgrade to rails 6.1
Diffstat (limited to 'config')
-rw-r--r-- | config/application.rb | 21 | ||||
-rw-r--r-- | config/environment.rb | 2 | ||||
-rw-r--r-- | config/environments/development.rb | 20 | ||||
-rw-r--r-- | config/environments/production.rb | 18 | ||||
-rw-r--r-- | config/environments/test.rb | 13 | ||||
-rw-r--r-- | config/initializers/assets.rb | 5 | ||||
-rw-r--r-- | config/initializers/backtrace_silencers.rb | 7 | ||||
-rw-r--r-- | config/initializers/filter_parameter_logging.rb | 4 |
8 files changed, 65 insertions, 25 deletions
diff --git a/config/application.rb b/config/application.rb index a798f40ce..7594255f8 100644 --- a/config/application.rb +++ b/config/application.rb @@ -1,8 +1,8 @@ # frozen_string_literal: true -require_relative 'boot' +require_relative "boot" -require 'rails/all' +require "rails/all" require_relative "bundler_helper" @@ -16,16 +16,19 @@ require_relative 'asset_sync' module Diaspora class Application < Rails::Application # Initialize configuration defaults for originally generated Rails version. - config.load_defaults 6.0 - - # Settings in config/environments/* take precedence over those specified here. - # Application configuration can go into files in config/initializers - # -- all .rb files in that directory are automatically loaded after loading - # the framework and any gems in your application. + config.load_defaults 6.1 # Use classic autoloader for now config.autoloader = :classic + # Configuration for the application, engines, and railties goes here. + # + # These settings can be overridden in specific environments using the files + # in config/environments, which are processed later. + # + # config.time_zone = "Central Time (US & Canada)" + # config.eager_load_paths << Rails.root.join("extras") + # Custom directories with classes and modules you want to be autoloadable. config.autoload_paths += %W[#{config.root}/app] config.autoload_once_paths += %W[#{config.root}/lib] @@ -58,8 +61,6 @@ module Diaspora } config.action_mailer.asset_host = AppConfig.pod_uri.to_s - config.action_view.raise_on_missing_translations = true - config.middleware.use Rack::OAuth2::Server::Resource::Bearer, "OpenID Connect" do |req| Api::OpenidConnect::OAuthAccessToken .valid(Time.zone.now.utc).find_by(token: req.access_token) || req.invalid_token! diff --git a/config/environment.rb b/config/environment.rb index d5abe5580..7df99e89c 100644 --- a/config/environment.rb +++ b/config/environment.rb @@ -1,7 +1,7 @@ # frozen_string_literal: true # Load the Rails application. -require_relative 'application' +require_relative "application" # Initialize the Rails application. Rails.application.initialize! diff --git a/config/environments/development.rb b/config/environments/development.rb index 8358d6b51..4342f872a 100644 --- a/config/environments/development.rb +++ b/config/environments/development.rb @@ -1,10 +1,12 @@ # frozen_string_literal: true +require "active_support/core_ext/integer/time" + Rails.application.configure do # Settings specified here will take precedence over those in config/application.rb. - # In the development environment your application's code is reloaded on - # every request. This slows down response time but is perfect for development + # In the development environment your application's code is reloaded any time + # it changes. This slows down response time but is perfect for development # since you don't have to restart the web server when you make code changes. config.cache_classes = false @@ -41,6 +43,12 @@ Rails.application.configure do # Print deprecation notices to the Rails logger. config.active_support.deprecation = :log + # Raise exceptions for disallowed deprecations. + config.active_support.disallowed_deprecation = :raise + + # Tell Active Support which deprecation messages to disallow. + config.active_support.disallowed_deprecation_warnings = [] + # Raise an error on page load if there are pending migrations. config.active_record.migration_error = :page_load @@ -62,12 +70,18 @@ Rails.application.configure do config.show_log_configuration = true # Raises error for missing translations. - # config.action_view.raise_on_missing_translations = true + config.i18n.raise_on_missing_translations = true + + # Annotate rendered view with file names. + # 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. + # config.action_cable.disable_request_forgery_protection = true + # Allow the host configured in the diaspora.toml to access the development server config.hosts << AppConfig.pod_uri.host diff --git a/config/environments/production.rb b/config/environments/production.rb index 60b0ba0f3..f3f927a8f 100644 --- a/config/environments/production.rb +++ b/config/environments/production.rb @@ -1,5 +1,7 @@ # frozen_string_literal: true +require "active_support/core_ext/integer/time" + Rails.application.configure do # Settings specified here will take precedence over those in config/application.rb. @@ -32,12 +34,9 @@ Rails.application.configure do # Do not fallback to assets pipeline if a precompiled asset is missed. config.assets.compile = false - # Generate digests for assets URLs. - config.assets.digest = true - # Enable serving of images, stylesheets, and JavaScripts from an asset server. if AppConfig.environment.assets.host.present? - config.action_controller.asset_host = AppConfig.environment.assets.host.get + config.asset_host = AppConfig.environment.assets.host.get end # Specifies the header that your server uses for sending files. @@ -55,7 +54,8 @@ Rails.application.configure do # Force all access to the app over SSL, use Strict-Transport-Security, and use secure cookies. # config.force_ssl = true - # Log level + # Include generic and useful information about system operation, but avoid logging too much + # information to avoid inadvertent exposure of personally identifiable information (PII). config.log_level = :info # Prepend all log lines with the following tags. @@ -87,11 +87,17 @@ Rails.application.configure do # Send deprecation notices to registered listeners. config.active_support.deprecation = :notify + # 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. # config.log_formatter = ::Logger::Formatter.new # Use a different logger for distributed setups. - # require 'syslog/logger' + # require "syslog/logger" # config.logger = ActiveSupport::TaggedLogging.new(Syslog::Logger.new 'app-name') # if ENV["RAILS_LOG_TO_STDOUT"].present? diff --git a/config/environments/test.rb b/config/environments/test.rb index 0762db9fd..d629f1e6c 100644 --- a/config/environments/test.rb +++ b/config/environments/test.rb @@ -1,5 +1,7 @@ # frozen_string_literal: true +require "active_support/core_ext/integer/time" + # The test environment is used exclusively to run your application's # test suite. You never need to work with it otherwise. Remember that # your test database is "scratch space" for the test suite and is wiped @@ -60,11 +62,20 @@ Rails.application.configure do # Print deprecation notices to the stderr. config.active_support.deprecation = :stderr + # Raise exceptions for disallowed deprecations. + config.active_support.disallowed_deprecation = :raise + + # Tell Active Support which deprecation messages to disallow. + config.active_support.disallowed_deprecation_warnings = [] + # Set the logging destination(s) config.log_to = %w[file] # Raises error for missing translations. - # config.action_view.raise_on_missing_translations = true + config.i18n.raise_on_missing_translations = true + + # Annotate rendered view with file names. + # config.action_view.annotate_rendered_view_with_filenames = true # for fixture_builder ENV["FIXTURES_PATH"] = "spec/fixtures" diff --git a/config/initializers/assets.rb b/config/initializers/assets.rb index 0874787e3..81c84e115 100644 --- a/config/initializers/assets.rb +++ b/config/initializers/assets.rb @@ -25,4 +25,9 @@ Rails.application.config.assets.version = "1.0" # Add Yarn node_modules folder to the asset load path. # Rails.application.config.assets.paths << Rails.root.join("node_modules") +# Precompile additional assets. +# application.js, application.css, and all non-JS/CSS in the app/assets +# folder are already added. +# Rails.application.config.assets.precompile += %w( admin.js admin.css ) + Rails.application.config.public_file_server.enabled = AppConfig.environment.assets.serve? diff --git a/config/initializers/backtrace_silencers.rb b/config/initializers/backtrace_silencers.rb index d0f0d3b5d..9290b5041 100644 --- a/config/initializers/backtrace_silencers.rb +++ b/config/initializers/backtrace_silencers.rb @@ -2,7 +2,8 @@ # Be sure to restart your server when you modify this file. # You can add backtrace silencers for libraries that you're using but don't wish to see in your backtraces. -# Rails.backtrace_cleaner.add_silencer { |line| line =~ /my_noisy_library/ } +# Rails.backtrace_cleaner.add_silencer { |line| /my_noisy_library/.match?(line) } -# You can also remove all the silencers if you're trying to debug a problem that might stem from framework code. -# Rails.backtrace_cleaner.remove_silencers! +# You can also remove all the silencers if you're trying to debug a problem that might stem from framework code +# by setting BACKTRACE=1 before calling your invocation, like "BACKTRACE=1 ./bin/rails runner 'MyClass.perform'". +Rails.backtrace_cleaner.remove_silencers! if ENV["BACKTRACE"] diff --git a/config/initializers/filter_parameter_logging.rb b/config/initializers/filter_parameter_logging.rb index dde581019..94e395494 100644 --- a/config/initializers/filter_parameter_logging.rb +++ b/config/initializers/filter_parameter_logging.rb @@ -3,4 +3,6 @@ # Be sure to restart your server when you modify this file. # Configure sensitive parameters which will be filtered from the log file. -Rails.application.config.filter_parameters += %i[password otp_attempt message text bio] +Rails.application.config.filter_parameters += %i[ + password passw secret token _key crypt salt certificate otp otp_attempt ssn message text bio +] |