summaryrefslogtreecommitdiff
path: root/lib/gitlab.rb
diff options
context:
space:
mode:
authorGitLab Bot <gitlab-bot@gitlab.com>2019-10-08 18:05:56 +0000
committerGitLab Bot <gitlab-bot@gitlab.com>2019-10-08 18:05:56 +0000
commit40597fdec080d55d36e97aab1a0b98dfc35517b9 (patch)
tree20cb97ab39cd511c22657cc23c5834464001feac /lib/gitlab.rb
parenta712542edb9d52105409462de3e56d2a6d6f6c7a (diff)
downloadgitlab-ce-40597fdec080d55d36e97aab1a0b98dfc35517b9.tar.gz
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'lib/gitlab.rb')
-rw-r--r--lib/gitlab.rb13
1 files changed, 7 insertions, 6 deletions
diff --git a/lib/gitlab.rb b/lib/gitlab.rb
index 43b3642fd6b..b337f5cbf2c 100644
--- a/lib/gitlab.rb
+++ b/lib/gitlab.rb
@@ -1,7 +1,6 @@
# frozen_string_literal: true
require 'pathname'
-require_relative '../config/light_settings'
module Gitlab
def self.root
@@ -38,18 +37,24 @@ module Gitlab
COM_URL = 'https://gitlab.com'
APP_DIRS_PATTERN = %r{^/?(app|config|ee|lib|spec|\(\w*\))}.freeze
+ SUBDOMAIN_REGEX = %r{\Ahttps://[a-z0-9]+\.gitlab\.com\z}.freeze
VERSION = File.read(root.join("VERSION")).strip.freeze
INSTALLATION_TYPE = File.read(root.join("INSTALLATION_TYPE")).strip.freeze
HTTP_PROXY_ENV_VARS = %w(http_proxy https_proxy HTTP_PROXY HTTPS_PROXY).freeze
def self.com?
- LightSettings.com?
+ # Check `gl_subdomain?` as well to keep parity with gitlab.com
+ Gitlab.config.gitlab.url == COM_URL || gl_subdomain?
end
def self.org?
Gitlab.config.gitlab.url == 'https://dev.gitlab.org'
end
+ def self.gl_subdomain?
+ SUBDOMAIN_REGEX === Gitlab.config.gitlab.url
+ end
+
def self.dev_env_org_or_com?
dev_env_or_com? || org?
end
@@ -74,10 +79,6 @@ module Gitlab
yield if ee?
end
- def self.com
- yield if com?
- end
-
def self.http_proxy_env?
HTTP_PROXY_ENV_VARS.any? { |name| ENV[name] }
end