change the default way to config AWS for carrierwave + fix issue #299
This commit is contained in:
parent
05baecad0b
commit
989f608755
@ -10,11 +10,14 @@ CarrierWave.configure do |config|
|
||||
|
||||
when :production
|
||||
# the following configuration works for Amazon S3
|
||||
config.storage = :s3
|
||||
config.s3_access_key_id = ENV['S3_KEY_ID']
|
||||
config.s3_secret_access_key = ENV['S3_SECRET_KEY']
|
||||
config.s3_bucket = ENV['S3_BUCKET']
|
||||
# config.s3_cname = ENV['S3_CNAME'] # optional
|
||||
config.storage = :fog
|
||||
config.fog_credentials = {
|
||||
:provider => 'AWS',
|
||||
:aws_access_key_id => ENV['S3_KEY_ID'],
|
||||
:aws_secret_access_key => ENV['S3_SECRET_KEY'],
|
||||
:region => 'us-east-1'
|
||||
}
|
||||
config.fog_directory = ENV['S3_BUCKET']
|
||||
|
||||
else
|
||||
# settings for the local filesystem
|
||||
|
@ -3,11 +3,7 @@ module CarrierWave
|
||||
class Base
|
||||
|
||||
def to_liquid
|
||||
{
|
||||
:url => self.url,
|
||||
:filename => (File.basename(self.url) rescue ''),
|
||||
:size => self.size
|
||||
}.stringify_keys
|
||||
Locomotive::Liquid::Drops::Uploader.new(self)
|
||||
end
|
||||
|
||||
end
|
||||
|
15
lib/locomotive/liquid/drops/uploader.rb
Normal file
15
lib/locomotive/liquid/drops/uploader.rb
Normal file
@ -0,0 +1,15 @@
|
||||
module Locomotive
|
||||
module Liquid
|
||||
module Drops
|
||||
class Uploader < Base
|
||||
|
||||
delegate :url, :size, :to => '_source'
|
||||
|
||||
def filename
|
||||
File.basename(self._source.url)
|
||||
end
|
||||
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
Loading…
Reference in New Issue
Block a user