summaryrefslogtreecommitdiff
path: root/config/application.rb
diff options
context:
space:
mode:
Diffstat (limited to 'config/application.rb')
-rw-r--r--config/application.rb54
1 files changed, 45 insertions, 9 deletions
diff --git a/config/application.rb b/config/application.rb
index dba9550a3dc..dde1eae30e7 100644
--- a/config/application.rb
+++ b/config/application.rb
@@ -16,6 +16,38 @@ Bundler.require(*Rails.groups)
module Gitlab
class Application < Rails::Application
+ config.load_defaults 6.1
+
+ # This section contains configuration from Rails upgrades to override the new defaults so that we
+ # keep existing behavior.
+ #
+ # For boolean values, the new default is the opposite of the value being set in this section.
+ # For other types, the new default is noted in the comments. These are also documented in
+ # https://guides.rubyonrails.org/configuring.html#results-of-config-load-defaults
+ #
+ # To switch a setting to the new default value, we just need to delete the specific line here.
+
+ # Rails 6.1
+ config.action_dispatch.cookies_same_site_protection = nil # New default is :lax
+ ActiveSupport.utc_to_local_returns_utc_offset_times = false
+ config.action_controller.urlsafe_csrf_tokens = false
+ config.action_view.preload_links_header = false
+
+ # Rails 5.2
+ config.action_dispatch.use_authenticated_cookie_encryption = false
+ config.active_support.use_authenticated_message_encryption = false
+ config.active_support.hash_digest_class = ::Digest::MD5 # New default is ::Digest::SHA1
+ config.action_controller.default_protect_from_forgery = false
+ config.action_view.form_with_generates_ids = false
+
+ # Rails 5.1
+ config.assets.unknown_asset_fallback = true
+
+ # Rails 5.0
+ config.action_controller.per_form_csrf_tokens = false
+ config.action_controller.forgery_protection_origin_check = false
+ ActiveSupport.to_time_preserves_timezone = false
+
require_dependency Rails.root.join('lib/gitlab')
require_dependency Rails.root.join('lib/gitlab/utils')
require_dependency Rails.root.join('lib/gitlab/action_cable/config')
@@ -28,6 +60,7 @@ module Gitlab
require_dependency Rails.root.join('lib/gitlab/redis/sessions')
require_dependency Rails.root.join('lib/gitlab/current_settings')
require_dependency Rails.root.join('lib/gitlab/middleware/read_only')
+ require_dependency Rails.root.join('lib/gitlab/middleware/compressed_json')
require_dependency Rails.root.join('lib/gitlab/middleware/basic_health_check')
require_dependency Rails.root.join('lib/gitlab/middleware/same_site_cookies')
require_dependency Rails.root.join('lib/gitlab/middleware/handle_ip_spoof_attack_error')
@@ -36,8 +69,6 @@ module Gitlab
require_dependency Rails.root.join('lib/gitlab/runtime')
require_dependency Rails.root.join('lib/gitlab/patch/legacy_database_config')
- config.autoloader = :zeitwerk
-
# To be removed in 15.0
# This preload is needed to convert legacy `database.yml`
# from `production: adapter: postgresql`
@@ -189,17 +220,18 @@ module Gitlab
# regardless if schema_search_path is set, or not.
config.active_record.dump_schemas = :all
- # Use new connection handling so that we can use Rails 6.1+ multiple
- # database support.
- config.active_record.legacy_connection_handling = false
-
- config.action_mailer.delivery_job = "ActionMailer::MailDeliveryJob"
+ # Override default Active Record settings
+ # We cannot do this in an initializer because some models are already loaded by then
+ config.active_record.cache_versioning = false
+ config.active_record.collection_cache_versioning = false
+ config.active_record.has_many_inversing = false
+ config.active_record.belongs_to_required_by_default = false
# Enable the asset pipeline
config.assets.enabled = true
# Support legacy unicode file named img emojis, `1F939.png`
- config.assets.paths << Gemojione.images_path
+ config.assets.paths << TanukiEmoji.images_path
config.assets.paths << "#{config.root}/vendor/assets/fonts"
config.assets.precompile << "application_utilities.css"
@@ -222,7 +254,7 @@ module Gitlab
config.assets.precompile << "page_bundles/build.css"
config.assets.precompile << "page_bundles/ci_status.css"
config.assets.precompile << "page_bundles/cycle_analytics.css"
- config.assets.precompile << "page_bundles/dev_ops_report.css"
+ config.assets.precompile << "page_bundles/dev_ops_reports.css"
config.assets.precompile << "page_bundles/environments.css"
config.assets.precompile << "page_bundles/epics.css"
config.assets.precompile << "page_bundles/error_tracking_details.css"
@@ -255,6 +287,7 @@ module Gitlab
config.assets.precompile << "page_bundles/security_discover.css"
config.assets.precompile << "page_bundles/signup.css"
config.assets.precompile << "page_bundles/terminal.css"
+ config.assets.precompile << "page_bundles/terms.css"
config.assets.precompile << "page_bundles/todos.css"
config.assets.precompile << "page_bundles/wiki.css"
config.assets.precompile << "page_bundles/xterm.css"
@@ -318,6 +351,8 @@ module Gitlab
config.middleware.insert_after Rack::Sendfile, ::Gitlab::Middleware::RackMultipartTempfileFactory
+ config.middleware.insert_before Rack::Runtime, ::Gitlab::Middleware::CompressedJson
+
# Allow access to GitLab API from other domains
config.middleware.insert_before Warden::Manager, Rack::Cors do
headers_to_expose = %w[Link X-Total X-Total-Pages X-Per-Page X-Page X-Next-Page X-Prev-Page X-Gitlab-Blob-Id X-Gitlab-Commit-Id X-Gitlab-Content-Sha256 X-Gitlab-Encoding X-Gitlab-File-Name X-Gitlab-File-Path X-Gitlab-Last-Commit-Id X-Gitlab-Ref X-Gitlab-Size]
@@ -376,6 +411,7 @@ module Gitlab
config.cache_store = :redis_cache_store, Gitlab::Redis::Cache.active_support_config
config.active_job.queue_adapter = :sidekiq
+ config.action_mailer.deliver_later_queue_name = :mailers
# This is needed for gitlab-shell
ENV['GITLAB_PATH_OUTSIDE_HOOK'] = ENV['PATH']