Skip to content
Snippets Groups Projects
Commit 1499b02f authored by blackst0ne's avatar blackst0ne
Browse files

[Rails5] Pass class references instead of strings to middleware builder

It fixes Rails 5.0 deprecation flooding like:

```
DEPRECATION WARNING: Passing strings or symbols to the middleware builder is deprecated, please change
them to actual class references.  For example:

  "::Gitlab::Middleware::ReadOnly" => Gitlab::Middleware::ReadOnly

 (called from <top (required)> at /builds/gitlab-org/gitlab-ce/config/environment.rb:11)
DEPRECATION WARNING: Passing strings or symbols to the middleware builder is deprecated, please change
them to actual class references.  For example:

  "ActionDispatch::Static" => ActionDispatch::Static

 (called from <top (required)> at /builds/gitlab-org/gitlab-ce/config/environment.rb:11)
DEPRECATION WARNING: Passing strings or symbols to the middleware builder is deprecated, please change
them to actual class references.  For example:

  "Gitlab::Testing::RequestBlockerMiddleware" => Gitlab::Testing::RequestBlockerMiddleware

 (called from <top (required)> at /builds/gitlab-org/gitlab-ce/config/environment.rb:11)
DEPRECATION WARNING: Passing strings or symbols to the middleware builder is deprecated, please change
them to actual class references.  For example:

  "ActionDispatch::Static" => ActionDispatch::Static

 (called from <top (required)> at /builds/gitlab-org/gitlab-ce/config/environment.rb:11)
DEPRECATION WARNING: Passing strings or symbols to the middleware builder is deprecated, please change
them to actual class references.  For example:

  "Gitlab::Testing::RequestInspectorMiddleware" => Gitlab::Testing::RequestInspectorMiddleware

 (called from <top (required)> at /builds/gitlab-org/gitlab-ce/config/environment.rb:11)
```
parent 8eea1a92
No related branches found
No related tags found
1 merge request!10495Merge Requests - Assignee
Loading
Loading
@@ -12,6 +12,7 @@ module Gitlab
require_dependency Rails.root.join('lib/gitlab/redis/shared_state')
require_dependency Rails.root.join('lib/gitlab/request_context')
require_dependency Rails.root.join('lib/gitlab/current_settings')
require_dependency Rails.root.join('lib/gitlab/middleware/read_only')
 
# Settings in config/environments/* take precedence over those specified here.
# Application configuration should go into files in config/initializers
Loading
Loading
@@ -175,7 +176,7 @@ module Gitlab
ENV['GIT_TERMINAL_PROMPT'] = '0'
 
# Gitlab Read-only middleware support
config.middleware.insert_after ActionDispatch::Flash, '::Gitlab::Middleware::ReadOnly'
config.middleware.insert_after ActionDispatch::Flash, ::Gitlab::Middleware::ReadOnly
 
config.generators do |g|
g.factory_bot false
Loading
Loading
Rails.application.configure do
# Make sure the middleware is inserted first in middleware chain
config.middleware.insert_before('ActionDispatch::Static', 'Gitlab::Testing::RequestBlockerMiddleware')
config.middleware.insert_before('ActionDispatch::Static', 'Gitlab::Testing::RequestInspectorMiddleware')
config.middleware.insert_before(ActionDispatch::Static, Gitlab::Testing::RequestBlockerMiddleware)
config.middleware.insert_before(ActionDispatch::Static, Gitlab::Testing::RequestInspectorMiddleware)
 
# Settings specified here will take precedence over those in config/application.rb
 
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment