mirror of
https://framagit.org/tykayn/mastodon.git
synced 2023-08-25 08:33:12 +02:00
🔧 S3 protocol from ENV
add support for reading S3 protocol from ENV also add S3_HOSTNAME in .env.production.sample
This commit is contained in:
parent
08faeedff7
commit
c46843c65c
@ -39,6 +39,8 @@ SMTP_FROM_ADDRESS=notifications@example.com
|
|||||||
# AWS_ACCESS_KEY_ID=
|
# AWS_ACCESS_KEY_ID=
|
||||||
# AWS_SECRET_ACCESS_KEY=
|
# AWS_SECRET_ACCESS_KEY=
|
||||||
# S3_REGION=
|
# S3_REGION=
|
||||||
|
# S3_PROTOCOL=http
|
||||||
|
# S3_HOSTNAME=192.168.1.123:9000
|
||||||
|
|
||||||
# Optional alias for S3 if you want to use Cloudfront or Cloudflare in front
|
# Optional alias for S3 if you want to use Cloudfront or Cloudflare in front
|
||||||
# S3_CLOUDFRONT_HOST=
|
# S3_CLOUDFRONT_HOST=
|
||||||
|
@ -11,7 +11,7 @@ if ENV['S3_ENABLED'] == 'true'
|
|||||||
Aws.eager_autoload!(services: %w(S3))
|
Aws.eager_autoload!(services: %w(S3))
|
||||||
|
|
||||||
Paperclip::Attachment.default_options[:storage] = :s3
|
Paperclip::Attachment.default_options[:storage] = :s3
|
||||||
Paperclip::Attachment.default_options[:s3_protocol] = 'https'
|
Paperclip::Attachment.default_options[:s3_protocol] = ENV.fetch('S3_PROTOCOL') { 'https' }
|
||||||
Paperclip::Attachment.default_options[:url] = ':s3_domain_url'
|
Paperclip::Attachment.default_options[:url] = ':s3_domain_url'
|
||||||
Paperclip::Attachment.default_options[:s3_host_name] = ENV.fetch('S3_HOSTNAME') { "s3-#{ENV.fetch('S3_REGION')}.amazonaws.com" }
|
Paperclip::Attachment.default_options[:s3_host_name] = ENV.fetch('S3_HOSTNAME') { "s3-#{ENV.fetch('S3_REGION')}.amazonaws.com" }
|
||||||
Paperclip::Attachment.default_options[:path] = '/:class/:attachment/:id_partition/:style/:filename'
|
Paperclip::Attachment.default_options[:path] = '/:class/:attachment/:id_partition/:style/:filename'
|
||||||
|
Loading…
Reference in New Issue
Block a user