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
path: root/config
diff options
context:
space:
mode:
authorGitLab Bot <gitlab-bot@gitlab.com>2023-06-08 03:11:42 +0300
committerGitLab Bot <gitlab-bot@gitlab.com>2023-06-08 03:11:42 +0300
commit356e3c444dc8fab920d3547461b6ae721c5eb50f (patch)
tree1de57bb445a71aeb8684f5a1f15d2b04fd60a99b /config
parente0d38e233de6113b51f784452d0f1f805356adaa (diff)
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'config')
-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