2019-07-08 21:06:24 -04:00
|
|
|
# frozen_string_literal: true
|
|
|
|
|
2021-04-13 14:11:28 -04:00
|
|
|
load_license = lambda do |dir:, license_name:|
|
2020-09-25 05:09:40 -04:00
|
|
|
prefix = ENV['GITLAB_LICENSE_MODE'] == 'test' ? 'test_' : ''
|
2021-04-13 14:11:28 -04:00
|
|
|
public_key_file = File.read(Rails.root.join(dir, ".#{prefix}license_encryption_key.pub"))
|
2020-02-24 16:09:08 -05:00
|
|
|
public_key = OpenSSL::PKey::RSA.new(public_key_file)
|
|
|
|
Gitlab::License.encryption_key = public_key
|
2021-04-26 08:09:44 -04:00
|
|
|
rescue StandardError
|
2021-04-13 14:11:28 -04:00
|
|
|
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-07-08 15:46:34 -04:00
|
|
|
end
|