Created
January 5, 2016 00:48
-
-
Save framallo/63019581d5a4e81f8ce3 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# config/initializers/carrierwave.rb | |
CarrierWave.configure do |config| | |
if Rails.env.production? | |
config.root = Rails.root.join('tmp') | |
config.cache_dir = 'carrierwave' | |
config.storage = :fog | |
config.fog_credentials = { | |
:provider => 'AWS', | |
:aws_access_key_id => ENV['S3_KEY_ID'], | |
:aws_secret_access_key => ENV['S3_SECRET_KEY'], | |
:persistent => false # This is required to prevent write timeouts from PUT requests to S3 | |
} | |
config.fog_directory = ENV['S3_BUCKET'] | |
config.fog_host = ENV['S3_HOST'] | |
config.fog_public = true | |
config.fog_attributes = {'Cache-Control'=>'max-age=315576000'} # Cache for 1 year | |
else | |
config.storage = :file | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment