Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'config/application.rb')
-rw-r--r--config/application.rb31
1 files changed, 21 insertions, 10 deletions
diff --git a/config/application.rb b/config/application.rb
index e5710edc811..b9792cba793 100644
--- a/config/application.rb
+++ b/config/application.rb
@@ -29,6 +29,7 @@ module Gitlab
require_dependency Rails.root.join('lib/gitlab/middleware/same_site_cookies')
require_dependency Rails.root.join('lib/gitlab/middleware/handle_ip_spoof_attack_error')
require_dependency Rails.root.join('lib/gitlab/middleware/handle_malformed_strings')
+ require_dependency Rails.root.join('lib/gitlab/middleware/rack_multipart_tempfile_factory')
require_dependency Rails.root.join('lib/gitlab/runtime')
# Settings in config/environments/* take precedence over those specified here.
@@ -56,21 +57,29 @@ module Gitlab
config.generators.templates.push("#{config.root}/generator_templates")
- if Gitlab.ee?
- ee_paths = config.eager_load_paths.each_with_object([]) do |path, memo|
- ee_path = config.root.join('ee', Pathname.new(path).relative_path_from(config.root))
- memo << ee_path.to_s
+ load_paths = lambda do |dir:|
+ ext_paths = config.eager_load_paths.each_with_object([]) do |path, memo|
+ ext_path = config.root.join(dir, Pathname.new(path).relative_path_from(config.root))
+ memo << ext_path.to_s
end
- ee_paths << "#{config.root}/ee/app/replicators"
+ ext_paths << "#{config.root}/#{dir}/app/replicators"
# Eager load should load CE first
- config.eager_load_paths.push(*ee_paths)
- config.helpers_paths.push "#{config.root}/ee/app/helpers"
+ config.eager_load_paths.push(*ext_paths)
+ config.helpers_paths.push "#{config.root}/#{dir}/app/helpers"
- # Other than Ruby modules we load EE first
- config.paths['lib/tasks'].unshift "#{config.root}/ee/lib/tasks"
- config.paths['app/views'].unshift "#{config.root}/ee/app/views"
+ # Other than Ruby modules we load extensions first
+ config.paths['lib/tasks'].unshift "#{config.root}/#{dir}/lib/tasks"
+ config.paths['app/views'].unshift "#{config.root}/#{dir}/app/views"
+ end
+
+ Gitlab.ee do
+ load_paths.call(dir: 'ee')
+ end
+
+ Gitlab.jh do
+ load_paths.call(dir: 'jh')
end
# Rake tasks ignore the eager loading settings, so we need to set the
@@ -271,6 +280,8 @@ module Gitlab
config.middleware.insert_after ActionDispatch::ActionableExceptions, ::Gitlab::Middleware::HandleMalformedStrings
+ config.middleware.insert_after Rack::Sendfile, ::Gitlab::Middleware::RackMultipartTempfileFactory
+
# 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]