闭社主体 forked from https://github.com/tootsuite/mastodon
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

14 lines
697 B

  1. if ENV['S3_ENABLED'] == 'true'
  2. Paperclip::Attachment.default_options[:storage] = :s3
  3. Paperclip::Attachment.default_options[:s3_protocol] = 'https'
  4. Paperclip::Attachment.default_options[:url] = ':s3_domain_url'
  5. Paperclip::Attachment.default_options[:s3_host_name] = "s3-#{ENV.fetch('S3_REGION')}.amazonaws.com"
  6. Paperclip::Attachment.default_options[:path] = '/:class/:attachment/:id_partition/:style/:filename'
  7. Paperclip::Attachment.default_options[:s3_credentials] = {
  8. bucket: ENV.fetch('S3_BUCKET'),
  9. access_key_id: ENV.fetch('AWS_ACCESS_KEY_ID'),
  10. secret_access_key: ENV.fetch('AWS_SECRET_ACCESS_KEY'),
  11. s3_region: ENV.fetch('S3_REGION')
  12. }
  13. end