summaryrefslogtreecommitdiff
path: root/config/helpers/is_jh_env.js
diff options
context:
space:
mode:
Diffstat (limited to 'config/helpers/is_jh_env.js')
-rw-r--r--config/helpers/is_jh_env.js16
1 files changed, 16 insertions, 0 deletions
diff --git a/config/helpers/is_jh_env.js b/config/helpers/is_jh_env.js
new file mode 100644
index 00000000000..10251d3166e
--- /dev/null
+++ b/config/helpers/is_jh_env.js
@@ -0,0 +1,16 @@
+const fs = require('fs');
+const path = require('path');
+const IS_EE = require('./is_ee_env');
+
+const ROOT_PATH = path.resolve(__dirname, '../..');
+
+// The `FOSS_ONLY` is always `string` or `nil`
+// Thus the nil or empty string will result
+// in using default value: false
+//
+// The behavior needs to be synchronised with
+// lib/gitlab.rb: Gitlab.jh?
+// Since IS_EE already satisifies the conditions of not being a FOSS_ONLY.
+// const isFossOnly = JSON.parse(process.env.FOSS_ONLY || 'false');
+const isEEOnly = JSON.parse(process.env.EE_ONLY || 'false');
+module.exports = IS_EE && !isEEOnly && fs.existsSync(path.join(ROOT_PATH, 'jh'));