Class: GitLab::SecretDetection::Gem
- Inherits:
-
Object
- Object
- GitLab::SecretDetection::Gem
- Defined in:
- lib/gitlab/secret_detection/version.rb
Constant Summary collapse
- DEFAULT_VERSION =
"0.0.1"- SEMVER_REGEX =
/^\d+\.\d+\.\d+(?:-[a-zA-Z0-9\-\.]+)?(?:\+[a-zA-Z0-9\-\.]+)?$/
Class Method Summary collapse
- .get_release_version ⇒ Object
-
.local_env? ⇒ Boolean
SD_ENV env var is used to determine which environment the server is running.
Class Method Details
.get_release_version ⇒ Object
10 11 12 13 14 15 16 17 18 19 20 21 22 |
# File 'lib/gitlab/secret_detection/version.rb', line 10 def self.get_release_version release_version = ENV.fetch("SD_GEM_RELEASE_VERSION", "") if release_version.empty? raise LoadError("Missing SD_GEM_RELEASE_VERSION environment variable.") unless local_env? "#{DEFAULT_VERSION}-debug" elsif release_version.match?(SEMVER_REGEX) release_version else "#{DEFAULT_VERSION}-#{release_version}" end end |
.local_env? ⇒ Boolean
SD_ENV env var is used to determine which environment the server is running. This var is defined in ‘.runway/env-<env>.yml` files.
26 27 28 |
# File 'lib/gitlab/secret_detection/version.rb', line 26 def self.local_env? ENV.fetch('SD_ENV', 'localhost') == 'localhost' end |