summaryrefslogtreecommitdiff
path: root/config
diff options
context:
space:
mode:
Diffstat (limited to 'config')
-rw-r--r--config/application.rb1
-rw-r--r--config/initializers/1_settings.rb6
-rw-r--r--config/initializers/2_gitlab.rb2
-rw-r--r--config/initializers/6_validations.rb10
-rw-r--r--config/initializers/carrierwave_monkey_patch.rb69
-rw-r--r--config/initializers/console_message.rb4
-rw-r--r--config/initializers/grape_route_helpers_fix.rb51
-rw-r--r--config/initializers/omniauth.rb9
-rw-r--r--config/routes/dashboard.rb1
-rw-r--r--config/routes/group.rb4
-rw-r--r--config/routes/profile.rb2
-rw-r--r--config/routes/project.rb1
12 files changed, 90 insertions, 70 deletions
diff --git a/config/application.rb b/config/application.rb
index 09f706e3d70..1b575f1325d 100644
--- a/config/application.rb
+++ b/config/application.rb
@@ -116,6 +116,7 @@ module Gitlab
config.assets.precompile << "snippets.css"
config.assets.precompile << "locale/**/app.js"
config.assets.precompile << "emoji_sprites.css"
+ config.assets.precompile << "errors.css"
# Import gitlab-svgs directly from vendored directory
config.assets.paths << "#{config.root}/node_modules/@gitlab-org/gitlab-svgs/dist"
diff --git a/config/initializers/1_settings.rb b/config/initializers/1_settings.rb
index dd36700964a..a0e3ab0d343 100644
--- a/config/initializers/1_settings.rb
+++ b/config/initializers/1_settings.rb
@@ -391,8 +391,10 @@ repositories_storages = Settings.repositories.storages.values
repository_downloads_path = Settings.gitlab['repository_downloads_path'].to_s.gsub(%r{/$}, '')
repository_downloads_full_path = File.expand_path(repository_downloads_path, Settings.gitlab['user_home'])
-if repository_downloads_path.blank? || repositories_storages.any? { |rs| [repository_downloads_path, repository_downloads_full_path].include?(rs.legacy_disk_path.gsub(%r{/$}, '')) }
- Settings.gitlab['repository_downloads_path'] = File.join(Settings.shared['path'], 'cache/archive')
+Gitlab::GitalyClient::StorageSettings.allow_disk_access do
+ if repository_downloads_path.blank? || repositories_storages.any? { |rs| [repository_downloads_path, repository_downloads_full_path].include?(rs.legacy_disk_path.gsub(%r{/$}, '')) }
+ Settings.gitlab['repository_downloads_path'] = File.join(Settings.shared['path'], 'cache/archive')
+ end
end
#
diff --git a/config/initializers/2_gitlab.rb b/config/initializers/2_gitlab.rb
index 1d2ab606a63..8b7f245b7b0 100644
--- a/config/initializers/2_gitlab.rb
+++ b/config/initializers/2_gitlab.rb
@@ -1 +1 @@
-require_relative '../../lib/gitlab'
+require_dependency 'gitlab'
diff --git a/config/initializers/6_validations.rb b/config/initializers/6_validations.rb
index 89aabe530fe..362a23164ab 100644
--- a/config/initializers/6_validations.rb
+++ b/config/initializers/6_validations.rb
@@ -38,10 +38,12 @@ def validate_storages_config
end
def validate_storages_paths
- Gitlab.config.repositories.storages.each do |name, repository_storage|
- parent_name, _parent_path = find_parent_path(name, repository_storage.legacy_disk_path)
- if parent_name
- storage_validation_error("#{name} is a nested path of #{parent_name}. Nested paths are not supported for repository storages")
+ Gitlab::GitalyClient::StorageSettings.allow_disk_access do
+ Gitlab.config.repositories.storages.each do |name, repository_storage|
+ parent_name, _parent_path = find_parent_path(name, repository_storage.legacy_disk_path)
+ if parent_name
+ storage_validation_error("#{name} is a nested path of #{parent_name}. Nested paths are not supported for repository storages")
+ end
end
end
end
diff --git a/config/initializers/carrierwave_monkey_patch.rb b/config/initializers/carrierwave_monkey_patch.rb
new file mode 100644
index 00000000000..7543231cd4f
--- /dev/null
+++ b/config/initializers/carrierwave_monkey_patch.rb
@@ -0,0 +1,69 @@
+# This fixes the problem https://gitlab.com/gitlab-org/gitlab-ce/issues/46182 that carrierwave eagerly loads upoloading files into memory
+# There is an PR https://github.com/carrierwaveuploader/carrierwave/pull/2314 which has the identical change.
+module CarrierWave
+ module Storage
+ class Fog < Abstract
+ class File
+ module MonkeyPatch
+ ##
+ # Read content of file from service
+ #
+ # === Returns
+ #
+ # [String] contents of file
+ def read
+ file_body = file.body
+
+ return if file_body.nil?
+ return file_body unless file_body.is_a?(::File)
+
+ # Fog::Storage::XXX::File#body could return the source file which was upoloaded to the remote server.
+ read_source_file(file_body) if ::File.exist?(file_body.path)
+
+ # If the source file doesn't exist, the remote content is read
+ @file = nil # rubocop:disable Gitlab/ModuleWithInstanceVariables
+ file.body
+ end
+
+ ##
+ # Write file to service
+ #
+ # === Returns
+ #
+ # [Boolean] true on success or raises error
+ def store(new_file)
+ if new_file.is_a?(self.class) # rubocop:disable Cop/LineBreakAroundConditionalBlock
+ new_file.copy_to(path)
+ else
+ fog_file = new_file.to_file
+ @content_type ||= new_file.content_type # rubocop:disable Gitlab/ModuleWithInstanceVariables
+ @file = directory.files.create({ # rubocop:disable Gitlab/ModuleWithInstanceVariables
+ :body => fog_file ? fog_file : new_file.read, # rubocop:disable Style/HashSyntax
+ :content_type => @content_type, # rubocop:disable Style/HashSyntax,Gitlab/ModuleWithInstanceVariables
+ :key => path, # rubocop:disable Style/HashSyntax
+ :public => @uploader.fog_public # rubocop:disable Style/HashSyntax,Gitlab/ModuleWithInstanceVariables
+ }.merge(@uploader.fog_attributes)) # rubocop:disable Gitlab/ModuleWithInstanceVariables
+ fog_file.close if fog_file && !fog_file.closed?
+ end
+ true
+ end
+
+ private
+
+ def read_source_file(file_body)
+ return unless ::File.exist?(file_body.path)
+
+ begin
+ file_body = ::File.open(file_body.path) if file_body.closed? # Reopen if it's already closed
+ file_body.read
+ ensure
+ file_body.close
+ end
+ end
+ end
+
+ prepend MonkeyPatch
+ end
+ end
+ end
+end
diff --git a/config/initializers/console_message.rb b/config/initializers/console_message.rb
index 2c46a25f365..f7c26732e6d 100644
--- a/config/initializers/console_message.rb
+++ b/config/initializers/console_message.rb
@@ -3,8 +3,8 @@ if defined?(Rails::Console)
# note that this will not print out when using `spring`
justify = 15
puts "-------------------------------------------------------------------------------------"
- puts " Gitlab:".ljust(justify) + "#{Gitlab::VERSION} (#{Gitlab.revision})"
- puts " Gitlab Shell:".ljust(justify) + Gitlab::Shell.new.version
+ puts " GitLab:".ljust(justify) + "#{Gitlab::VERSION} (#{Gitlab.revision})"
+ puts " GitLab Shell:".ljust(justify) + "#{Gitlab::VersionInfo.parse(Gitlab::Shell.new.version)}"
puts " #{Gitlab::Database.adapter_name}:".ljust(justify) + Gitlab::Database.version
puts "-------------------------------------------------------------------------------------"
end
diff --git a/config/initializers/grape_route_helpers_fix.rb b/config/initializers/grape_route_helpers_fix.rb
deleted file mode 100644
index 612cca3dfbd..00000000000
--- a/config/initializers/grape_route_helpers_fix.rb
+++ /dev/null
@@ -1,51 +0,0 @@
-if defined?(GrapeRouteHelpers)
- module GrapeRouteHelpers
- module AllRoutes
- # Bringing in PR https://github.com/reprah/grape-route-helpers/pull/21 due to abandonment.
- #
- # Without the following fix, when two helper methods are the same, but have different arguments
- # (for example: api_v1_cats_owners_path(id: 1) vs api_v1_cats_owners_path(id: 1, owner_id: 2))
- # if the helper method with the least number of arguments is defined first (because the route was defined first)
- # then it will shadow the longer route.
- #
- # The fix is to sort descending by amount of arguments
- def decorated_routes
- @decorated_routes ||= all_routes
- .map { |r| DecoratedRoute.new(r) }
- .sort_by { |r| -r.dynamic_path_segments.count }
- end
- end
-
- class DecoratedRoute
- # GrapeRouteHelpers gem tries to parse the versions
- # from a string, not supporting Grape `version` array definition.
- #
- # Without the following fix, we get this on route helpers generation:
- #
- # => undefined method `scan' for ["v3", "v4"]
- #
- # 2.0.0 implementation of this method:
- #
- # ```
- # def route_versions
- # version_pattern = /[^\[",\]\s]+/
- # if route_version
- # route_version.scan(version_pattern)
- # else
- # [nil]
- # end
- # end
- # ```
- def route_versions
- return [nil] if route_version.nil? || route_version.empty?
-
- if route_version.is_a?(String)
- version_pattern = /[^\[",\]\s]+/
- route_version.scan(version_pattern)
- else
- route_version
- end
- end
- end
- end
-end
diff --git a/config/initializers/omniauth.rb b/config/initializers/omniauth.rb
index e33ebb25c4c..a7fa926a853 100644
--- a/config/initializers/omniauth.rb
+++ b/config/initializers/omniauth.rb
@@ -19,12 +19,5 @@ end
if Gitlab.config.omniauth.enabled
provider_names = Gitlab.config.omniauth.providers.map(&:name)
- require 'omniauth-kerberos' if provider_names.include?('kerberos')
-end
-
-module OmniAuth
- module Strategies
- autoload :Bitbucket, Rails.root.join('lib', 'omni_auth', 'strategies', 'bitbucket')
- autoload :Jwt, Rails.root.join('lib', 'omni_auth', 'strategies', 'jwt')
- end
+ Gitlab::Auth.omniauth_setup_providers(provider_names)
end
diff --git a/config/routes/dashboard.rb b/config/routes/dashboard.rb
index d2437285cdf..f1e8c2b9d82 100644
--- a/config/routes/dashboard.rb
+++ b/config/routes/dashboard.rb
@@ -1,4 +1,5 @@
resource :dashboard, controller: 'dashboard', only: [] do
+ get :issues, action: :issues_calendar, constraints: lambda { |req| req.format == :ics }
get :issues
get :merge_requests
get :activity
diff --git a/config/routes/group.rb b/config/routes/group.rb
index 7c4c3d370e0..b09eb3c1b5b 100644
--- a/config/routes/group.rb
+++ b/config/routes/group.rb
@@ -5,9 +5,10 @@ end
constraints(::Constraints::GroupUrlConstrainer.new) do
scope(path: 'groups/*id',
controller: :groups,
- constraints: { id: Gitlab::PathRegex.full_namespace_route_regex, format: /(html|json|atom)/ }) do
+ constraints: { id: Gitlab::PathRegex.full_namespace_route_regex, format: /(html|json|atom|ics)/ }) do
scope(path: '-') do
get :edit, as: :edit_group
+ get :issues, as: :issues_group_calendar, action: :issues_calendar, constraints: lambda { |req| req.format == :ics }
get :issues, as: :issues_group
get :merge_requests, as: :merge_requests_group
get :projects, as: :projects_group
@@ -30,6 +31,7 @@ constraints(::Constraints::GroupUrlConstrainer.new) do
resource :variables, only: [:show, :update]
resources :children, only: [:index]
+ resources :shared_projects, only: [:index]
resources :labels, except: [:show] do
post :toggle_subscription, on: :member
diff --git a/config/routes/profile.rb b/config/routes/profile.rb
index a9ba5ac2c0b..c1cac3905f1 100644
--- a/config/routes/profile.rb
+++ b/config/routes/profile.rb
@@ -7,7 +7,7 @@ resource :profile, only: [:show, :update] do
get :applications, to: 'oauth/applications#index'
put :reset_incoming_email_token
- put :reset_rss_token
+ put :reset_feed_token
put :update_username
end
diff --git a/config/routes/project.rb b/config/routes/project.rb
index 5a1be1a8b73..6dfbd7ecd1f 100644
--- a/config/routes/project.rb
+++ b/config/routes/project.rb
@@ -353,6 +353,7 @@ constraints(::Constraints::ProjectUrlConstrainer.new) do
end
end
+ get :issues, to: 'issues#calendar', constraints: lambda { |req| req.format == :ics }
resources :issues, concerns: :awardable, constraints: { id: /\d+/ } do
member do
post :toggle_subscription