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:
Diffstat (limited to 'config/initializers/0_license.rb')
-rw-r--r--config/initializers/0_license.rb23
1 files changed, 17 insertions, 6 deletions
diff --git a/config/initializers/0_license.rb b/config/initializers/0_license.rb
index c1a2048b28d..c6a09a2f769 100644
--- a/config/initializers/0_license.rb
+++ b/config/initializers/0_license.rb
@@ -1,12 +1,23 @@
# frozen_string_literal: true
load_license = lambda do |dir:, license_name:|
- prefix = ENV['GITLAB_LICENSE_MODE'] == 'test' ? 'test_' : ''
- public_key_file = File.read(Rails.root.join(dir, ".#{prefix}license_encryption_key.pub"))
- public_key = OpenSSL::PKey::RSA.new(public_key_file)
- Gitlab::License.encryption_key = public_key
-rescue StandardError
- warn "WARNING: No valid #{license_name} encryption key provided."
+ begin
+ public_key_file = File.read(Rails.root.join(dir, ".license_encryption_key.pub"))
+ public_key = OpenSSL::PKey::RSA.new(public_key_file)
+ Gitlab::License.encryption_key = public_key
+ rescue StandardError
+ warn "WARNING: No valid #{license_name} encryption key provided."
+ end
+
+ begin
+ if Rails.env.development? || Rails.env.test? || ENV['GITLAB_LICENSE_MODE'] == 'test'
+ fallback_key_file = File.read(Rails.root.join(dir, ".test_license_encryption_key.pub"))
+ fallback_key = OpenSSL::PKey::RSA.new(fallback_key_file)
+ Gitlab::License.fallback_decryption_keys = [fallback_key]
+ end
+ rescue StandardError
+ warn "WARNING: No fallback #{license_name} decryption key provided."
+ end
end
Gitlab.ee do