about summary refs log tree commit diff
path: root/config/initializers
diff options
context:
space:
mode:
authorJamie Hoyle <j@jamiehoyle.com>2023-03-03 19:53:37 +0000
committerGitHub <noreply@github.com>2023-03-03 20:53:37 +0100
commitde137e6bb0d69354b4be5d4a8d845f8bd90551ff (patch)
tree73c1c1e53ebd6b6497b26d2056ad9536e86ade1a /config/initializers
parent3f52e717fa22e89a0eaf5f12f0fb9d2b121c7944 (diff)
Added support for specifying S3 storage classes in environment (#22480)
Diffstat (limited to 'config/initializers')
-rw-r--r--config/initializers/paperclip.rb6
1 files changed, 6 insertions, 0 deletions
diff --git a/config/initializers/paperclip.rb b/config/initializers/paperclip.rb
index a2285427c..9282c941d 100644
--- a/config/initializers/paperclip.rb
+++ b/config/initializers/paperclip.rb
@@ -90,6 +90,12 @@ if ENV['S3_ENABLED'] == 'true'
     )
   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
   # used by kt-paperclip, see https://github.com/mastodon/mastodon/issues/16822
   if ENV['S3_FORCE_SINGLE_REQUEST'] == 'true'