debian-mirror-gitlab/config/initializers/0_license.rb

19 lines
577 B
Ruby
Raw Normal View History

2019-09-30 21:07:59 +05:30
# frozen_string_literal: true
2021-04-29 21:17:54 +05:30
load_license = lambda do |dir:, license_name:|
2021-01-03 14:25:43 +05:30
prefix = ENV['GITLAB_LICENSE_MODE'] == 'test' ? 'test_' : ''
2021-04-29 21:17:54 +05:30
public_key_file = File.read(Rails.root.join(dir, ".#{prefix}license_encryption_key.pub"))
2020-04-08 14:13:33 +05:30
public_key = OpenSSL::PKey::RSA.new(public_key_file)
Gitlab::License.encryption_key = public_key
2021-06-08 01:23:25 +05:30
rescue StandardError
2021-04-29 21:17:54 +05:30
warn "WARNING: No valid #{license_name} encryption key provided."
end
Gitlab.ee do
load_license.call(dir: '.', license_name: 'license')
end
Gitlab.jh do
load_license.call(dir: 'jh', license_name: 'JH license')
2019-09-30 21:07:59 +05:30
end