diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2020-03-27 12:07:43 +0000 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2020-03-27 12:07:43 +0000 |
commit | 39fa7d1eeb2dba52f0601128f3ac91f57d19866e (patch) | |
tree | da042d34ff762dd1957e51666a34202295a081b9 /app/uploaders | |
parent | 6ac4a6713ed3196af899011f7e18658e16ebaac0 (diff) | |
download | gitlab-ce-39fa7d1eeb2dba52f0601128f3ac91f57d19866e.tar.gz |
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'app/uploaders')
-rw-r--r-- | app/uploaders/terraform/state_uploader.rb | 44 |
1 files changed, 44 insertions, 0 deletions
diff --git a/app/uploaders/terraform/state_uploader.rb b/app/uploaders/terraform/state_uploader.rb new file mode 100644 index 00000000000..9c5ae8a8bdc --- /dev/null +++ b/app/uploaders/terraform/state_uploader.rb @@ -0,0 +1,44 @@ +# frozen_string_literal: true + +module Terraform + class StateUploader < GitlabUploader + include ObjectStorage::Concern + + storage_options Gitlab.config.terraform_state + + delegate :project_id, to: :model + + # Use Lockbox to encrypt/decrypt the stored file (registers CarrierWave callbacks) + encrypt(key: :key) + + def filename + "#{model.id}.tfstate" + end + + def store_dir + project_id.to_s + end + + def key + OpenSSL::HMAC.digest('SHA256', Gitlab::Application.secrets.db_key_base, project_id.to_s) + end + + class << self + def direct_upload_enabled? + false + end + + def background_upload_enabled? + false + end + + def proxy_download_enabled? + true + end + + def default_store + object_store_enabled? ? ObjectStorage::Store::REMOTE : ObjectStorage::Store::LOCAL + end + end + end +end |