-
-
Save seguelador/529d5efb812b4a83f8ff15a6d0c10855 to your computer and use it in GitHub Desktop.
Base Fog Carrierwave config
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
| if Rails.env.test? | |
| CarrierWave.configure do |config| | |
| config.storage = :file | |
| config.enable_processing = false | |
| end | |
| else | |
| CarrierWave.configure do |config| | |
| config.fog_credentials = { | |
| :provider => 'AWS', # required | |
| :aws_access_key_id => ENV['aws_access_key_id'], # required | |
| :aws_secret_access_key => ENV['aws_secret_access_key'] # required | |
| #:region => 'us-east-1' # optional, defaults to 'us-east-1' | |
| #:host => 's3.example.com', # optional, defaults to nil | |
| #:endpoint => 'https://s3.example.com:8080' # optional, defaults to nil | |
| } | |
| config.storage = :fog | |
| config.fog_directory = ENV['aws_dir'] # required | |
| config.fog_public = false # optional, defaults to true | |
| config.fog_attributes = {'Cache-Control'=>"max-age=#{365.day.to_i}"} # optional, defaults to {} | |
| config.fog_authenticated_url_expiration = 60000 # 1000 minutes | |
| end | |
| end |
Author
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
You should move
config.storage = :fogafterconfig.fog_credentialsor you will get this error:More info in this link: carrierwaveuploader/carrierwave#2023