]> cat aescling's git repositories - mastodon.git/commitdiff
Fix insecure S3 URLs
authorEugen Rochko <eugen@zeonfederated.com>
Sun, 6 Nov 2016 19:59:06 +0000 (20:59 +0100)
committerEugen Rochko <eugen@zeonfederated.com>
Sun, 6 Nov 2016 19:59:06 +0000 (20:59 +0100)
config/initializers/paperclip.rb

index d727612507dde858ef4d67a593c4313bb50f7bf2..74aa076fedc7f48500d97888d88e1b07de79ecdb 100644 (file)
@@ -1,5 +1,8 @@
 if ENV['S3_ENABLED'] == 'true'
-  Paperclip::Attachment.default_options[:storage] = :s3
+  Paperclip::Attachment.default_options[:storage]     = :s3
+  Paperclip::Attachment.default_options[:s3_protocol] = 'https'
+  Paperclip::Attachment.default_options[:url]         = ':s3_domain_url'
+  Paperclip::Attachment.default_options[:path]        = '/:class/:attachment/:id_partition/:style/:filename'
 
   Paperclip::Attachment.default_options[:s3_credentials] = {
     bucket: ENV.fetch('S3_BUCKET'),
@@ -7,7 +10,4 @@ if ENV['S3_ENABLED'] == 'true'
     secret_access_key: ENV.fetch('AWS_SECRET_ACCESS_KEY'),
     s3_region: ENV.fetch('S3_REGION')
   }
-
-  Paperclip::Attachment.default_options[:url] = ':s3_domain_url'
-  Paperclip::Attachment.default_options[:path] = '/:class/:attachment/:id_partition/:style/:filename'
 end