Enhancement: Use S3 for active storage (#398)

This commit is contained in:
Sojan Jose 2019-12-29 11:13:28 +05:30 committed by Pranav Raj S
parent e2aeeeca43
commit bacc0b2f18
3 changed files with 8 additions and 7 deletions

View file

@ -25,6 +25,7 @@ SMTP_ENABLE_STARTTLS_AUTO=
#misc
FRONTEND_URL=http://0.0.0.0:3000
ACTIVE_STORAGE_SERVICE=local
#s3
S3_BUCKET_NAME=

View file

@ -36,7 +36,7 @@ Rails.application.configure do
# config.action_dispatch.x_sendfile_header = 'X-Accel-Redirect' # for NGINX
# Store uploaded files on the local file system (see config/storage.yml for options).
config.active_storage.service = :local
config.active_storage.service = ENV.fetch('ACTIVE_STORAGE_SERVICE', 'local').to_sym
# Force all access to the app over SSL, use Strict-Transport-Security, and use secure cookies.
# config.force_ssl = true

View file

@ -7,12 +7,12 @@ local:
root: <%= Rails.root.join("storage") %>
# Use rails credentials:edit to set the AWS secrets (as aws:access_key_id|secret_access_key)
# amazon:
# service: S3
# access_key_id: <%= Rails.application.credentials.dig(:aws, :access_key_id) %>
# secret_access_key: <%= Rails.application.credentials.dig(:aws, :secret_access_key) %>
# region: us-east-1
# bucket: your_own_bucket
amazon:
service: S3
access_key_id: <%= ENV.fetch('AWS_ACCESS_KEY_ID', '') %>
secret_access_key: <%= ENV.fetch('AWS_SECRET_ACCESS_KEY', '') %>
region: <%= ENV.fetch('AWS_REGION', '') %>
bucket: <%= ENV.fetch('S3_BUCKET_NAME', '') %>
# Remember not to checkin your GCS keyfile to a repository
# google: