Added support for specifying S3 storage classes in environment (#22480)

This commit is contained in:
Jamie Hoyle 2023-03-03 19:53:37 +00:00 committed by GitHub
parent 3f52e717fa
commit de137e6bb0
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -90,6 +90,12 @@ if ENV['S3_ENABLED'] == 'true'
) )
end end
if ENV.has_key?('S3_STORAGE_CLASS')
Paperclip::Attachment.default_options[:s3_headers].merge!(
'X-Amz-Storage-Class' => ENV['S3_STORAGE_CLASS']
)
end
# Some S3-compatible providers might not actually be compatible with some APIs # Some S3-compatible providers might not actually be compatible with some APIs
# used by kt-paperclip, see https://github.com/mastodon/mastodon/issues/16822 # used by kt-paperclip, see https://github.com/mastodon/mastodon/issues/16822
if ENV['S3_FORCE_SINGLE_REQUEST'] == 'true' if ENV['S3_FORCE_SINGLE_REQUEST'] == 'true'