Commit f5bf17c9 authored by Grzegorz Bizon's avatar Grzegorz Bizon

Merge branch 'make-is-gitlab-ee-consistent' into 'master'

Make IS_GITLAB_EE consistent

See merge request gitlab-org/gitlab!18442
parents d51133ad 49dda390
...@@ -3,7 +3,12 @@ const path = require('path'); ...@@ -3,7 +3,12 @@ const path = require('path');
const ROOT_PATH = path.resolve(__dirname, '../..'); const ROOT_PATH = path.resolve(__dirname, '../..');
// The `IS_GITLAB_EE` is always `string` or `nil`
// Thus the nil or empty string will result
// in using default value: true
//
// The behavior needs to be synchronised with
// lib/gitlab.rb: Gitlab.ee?
module.exports = module.exports =
process.env.IS_GITLAB_EE !== undefined fs.existsSync(path.join(ROOT_PATH, 'ee', 'app', 'models', 'license.rb')) &&
? JSON.parse(process.env.IS_GITLAB_EE) (!process.env.IS_GITLAB_EE || JSON.parse(process.env.IS_GITLAB_EE));
: fs.existsSync(path.join(ROOT_PATH, 'ee'));
...@@ -65,14 +65,18 @@ module Gitlab ...@@ -65,14 +65,18 @@ module Gitlab
def self.ee? def self.ee?
@is_ee ||= @is_ee ||=
if ENV['IS_GITLAB_EE'] && !ENV['IS_GITLAB_EE'].empty? # We use this method when the Rails environment is not loaded. This
Gitlab::Utils.to_boolean(ENV['IS_GITLAB_EE']) # means that checking the presence of the License class could result in
else # this method returning `false`, even for an EE installation.
# We may use this method when the Rails environment is not loaded. This #
# means that checking the presence of the License class could result in # The `IS_GITLAB_EE` is always `string` or `nil`
# this method returning `false`, even for an EE installation. # Thus the nil or empty string will result
root.join('ee/app/models/license.rb').exist? # in using default value: true
end #
# The behavior needs to be synchronised with
# config/helpers/is_ee_env.js
root.join('ee/app/models/license.rb').exist? &&
(ENV['IS_GITLAB_EE'].to_s.empty? || Gitlab::Utils.to_boolean(ENV['IS_GITLAB_EE']))
end end
def self.ee def self.ee
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment