diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2019-10-08 21:05:56 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2019-10-08 21:05:56 +0300 |
commit | 40597fdec080d55d36e97aab1a0b98dfc35517b9 (patch) | |
tree | 20cb97ab39cd511c22657cc23c5834464001feac /config | |
parent | a712542edb9d52105409462de3e56d2a6d6f6c7a (diff) |
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'config')
-rw-r--r-- | config/application.rb | 10 | ||||
-rw-r--r-- | config/initializers/0_inject_com_module.rb | 26 | ||||
-rw-r--r-- | config/light_settings.rb | 32 |
3 files changed, 0 insertions, 68 deletions
diff --git a/config/application.rb b/config/application.rb index 192e836594a..5d7c52c5d81 100644 --- a/config/application.rb +++ b/config/application.rb @@ -22,7 +22,6 @@ module Gitlab 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/basic_health_check') - require_dependency Rails.root.join('config/light_settings') # Settings in config/environments/* take precedence over those specified here. # Application configuration should go into files in config/initializers @@ -63,15 +62,6 @@ module Gitlab config.paths['app/views'].unshift "#{config.root}/ee/app/views" end - if LightSettings.com? - com_paths = config.eager_load_paths.each_with_object([]) do |path, memo| - com_path = config.root.join('com', Pathname.new(path).relative_path_from(config.root)) - memo << com_path.to_s - end - - config.eager_load_paths.push(*com_paths) - end - # Rake tasks ignore the eager loading settings, so we need to set the # autoload paths explicitly config.autoload_paths = config.eager_load_paths.dup diff --git a/config/initializers/0_inject_com_module.rb b/config/initializers/0_inject_com_module.rb deleted file mode 100644 index 9802eb37ec3..00000000000 --- a/config/initializers/0_inject_com_module.rb +++ /dev/null @@ -1,26 +0,0 @@ -# frozen_string_literal: true - -require 'active_support/inflector' - -module InjectComModule - def prepend_if_com(constant, with_descendants: false) - return unless Gitlab.com? - - com_module = constant.constantize - prepend(com_module) - - if with_descendants - descendants.each { |descendant| descendant.prepend(com_module) } - end - end - - def extend_if_com(constant) - extend(constant.constantize) if Gitlab.com? - end - - def include_if_com(constant) - include(constant.constantize) if Gitlab.com? - end -end - -Module.prepend(InjectComModule) diff --git a/config/light_settings.rb b/config/light_settings.rb deleted file mode 100644 index 19343ba7de0..00000000000 --- a/config/light_settings.rb +++ /dev/null @@ -1,32 +0,0 @@ -# frozen_string_literal: true - -class LightSettings - GL_HOST ||= 'gitlab.com' - GL_SUBDOMAIN_REGEX ||= %r{\A[a-z0-9]+\.gitlab\.com\z}.freeze - - class << self - def com? - return Thread.current[:is_com] unless Thread.current[:is_com].nil? - - Thread.current[:is_com] = host == GL_HOST || gl_subdomain? - end - - private - - def config - YAML.safe_load(File.read(settings_path), aliases: true)[Rails.env] - end - - def settings_path - Rails.root.join('config', 'gitlab.yml') - end - - def host - config.dig('gitlab', 'host') || ENV['GITLAB_HOST'] || 'localhost' - end - - def gl_subdomain? - GL_SUBDOMAIN_REGEX === host - end - end -end |