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:
authorGitLab Bot <gitlab-bot@gitlab.com>2023-01-25 21:08:56 +0300
committerGitLab Bot <gitlab-bot@gitlab.com>2023-01-25 21:08:56 +0300
commitff549ec680715e4ea1daf0cee457f29dfe3b6062 (patch)
tree823fc28718a1278025ee2d88c1368958befec4da /lib/gitlab.rb
parentec558ad8ed732ff6f8a89aa3651eb92c27c50deb (diff)
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'lib/gitlab.rb')
-rw-r--r--lib/gitlab.rb15
1 files changed, 13 insertions, 2 deletions
diff --git a/lib/gitlab.rb b/lib/gitlab.rb
index 1190c92ce17..2eff78efbec 100644
--- a/lib/gitlab.rb
+++ b/lib/gitlab.rb
@@ -4,8 +4,11 @@ require 'pathname'
require 'forwardable'
require_relative 'gitlab_edition'
+require_relative 'gitlab/utils'
module Gitlab
+ GITLAB_SIMULATE_SAAS = Gitlab::Utils.to_boolean(ENV['GITLAB_SIMULATE_SAAS'], default: false)
+
class << self
extend Forwardable
@@ -49,10 +52,18 @@ module Gitlab
INSTALLATION_TYPE = File.read(root.join("INSTALLATION_TYPE")).strip.freeze
HTTP_PROXY_ENV_VARS = %w(http_proxy https_proxy HTTP_PROXY HTTPS_PROXY).freeze
+ # We allow GitLab instances to "pretend" they are SaaS to test SaaS-specific code
+ # paths, but only when in development mode or when running on production instances
+ # with a license issued to a GitLab team member.
def self.simulate_com?
- return false unless Rails.env.development?
+ return false unless GITLAB_SIMULATE_SAAS
+ return false if Rails.env.test?
+
+ Rails.env.development? || licensed_to_gitlab_team_member?
+ end
- Gitlab::Utils.to_boolean(ENV['GITLAB_SIMULATE_SAAS'])
+ def self.licensed_to_gitlab_team_member?
+ ee? && ::License.current&.issued_to_gitlab_team_member?
end
def self.com?