Chore: Switch from Carrierwave to ActiveStorage (#393)

This commit is contained in:
Sojan Jose
2020-01-07 22:59:17 +05:30
committed by Pranav Raj S
parent f02d422b6a
commit f875a09fb7
29 changed files with 192 additions and 164 deletions

View File

@@ -1,37 +0,0 @@
CarrierWave.configure do |config|
config.storage = :file
end
if Rails.env.production?
CarrierWave.configure do |config|
config.storage = :aws
config.aws_bucket = ENV['S3_BUCKET_NAME']
config.aws_acl = 'authenticated-read'
# Optionally define an asset host for configurations that are fronted by a
# content host, such as CloudFront.
# config.asset_host = 'http://example.com'
# The maximum period for authenticated_urls is only 7 days.
config.aws_authenticated_url_expiration = 60 * 60 * 24 * 7
# Set custom options such as cache control to leverage browser caching
config.aws_attributes = {
expires: 1.week.from_now.httpdate,
cache_control: 'max-age=604800'
}
config.aws_credentials = {
access_key_id: ENV['AWS_ACCESS_KEY_ID'],
secret_access_key: ENV['AWS_SECRET_ACCESS_KEY'],
region: ENV['AWS_REGION'] # Required
}
# Optional: Signing of download urls, e.g. for serving private content through
# CloudFront. Be sure you have the `cloudfront-signer` gem installed and
# configured:
# config.aws_signer = -> (unsigned_url, options) do
# Aws::CF::Signer.sign_url(unsigned_url, options)
# end
end
end

View File

@@ -15,18 +15,18 @@ amazon:
bucket: <%= ENV.fetch('S3_BUCKET_NAME', '') %>
# Remember not to checkin your GCS keyfile to a repository
# google:
# service: GCS
# project: your_project
# credentials: <%= Rails.root.join("path/to/gcs.keyfile") %>
# bucket: your_own_bucket
google:
service: GCS
project: <%= ENV.fetch('GCS_PROJECT', '') %>
credentials: <%= ENV.fetch('GCS_CREDENTIALS', '').to_json %>
bucket: <%= ENV.fetch('GCS_BUCKET', '') %>
# Use rails credentials:edit to set the Azure Storage secret (as azure_storage:storage_access_key)
# microsoft:
# service: AzureStorage
# storage_account_name: your_account_name
# storage_access_key: <%= Rails.application.credentials.dig(:azure_storage, :storage_access_key) %>
# container: your_container_name
microsoft:
service: AzureStorage
storage_account_name: <%= ENV.fetch('AZURE_STORAGE_ACCOUNT_NAME', '') %>
storage_access_key: <%= ENV.fetch('AZURE_STORAGE_ACCESS_KEY', '') %>
container: <%= ENV.fetch('AZURE_STORAGE_CONTAINER', '') %>
# mirror:
# service: Mirror