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.

16 lines
739 B

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