diff options
author | Nick Thomas <nick@gitlab.com> | 2019-01-09 17:01:28 +0000 |
---|---|---|
committer | Nick Thomas <nick@gitlab.com> | 2019-02-05 14:12:48 +0000 |
commit | f9e41d0d851ae0ab1d67df63d0309fdce97517e1 (patch) | |
tree | 3c71a5853b789ff57d8a47522d8603c36eb7aa59 /app/uploaders | |
parent | f04910f254c29047dd3ae798161683a722e7162b (diff) | |
download | gitlab-ce-f9e41d0d851ae0ab1d67df63d0309fdce97517e1.tar.gz |
Allow MR diffs to be placed into an object store
Diffstat (limited to 'app/uploaders')
-rw-r--r-- | app/uploaders/external_diff_uploader.rb | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/app/uploaders/external_diff_uploader.rb b/app/uploaders/external_diff_uploader.rb new file mode 100644 index 00000000000..d2707cd0777 --- /dev/null +++ b/app/uploaders/external_diff_uploader.rb @@ -0,0 +1,23 @@ +# frozen_string_literal: true + +class ExternalDiffUploader < GitlabUploader + include ObjectStorage::Concern + + storage_options Gitlab.config.external_diffs + + alias_method :upload, :model + + def filename + "diff-#{model.id}" + end + + def store_dir + dynamic_segment + end + + private + + def dynamic_segment + File.join(model.model_name.plural, "mr-#{model.merge_request_id}") + end +end |