Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Files are uploaded to S3 if the ENV variables are set (Heroku-friendly)

  • Loading branch information...
commit 6e0082da9e46a35643b87369951bcb22175a8f5e 1 parent 64e1912
@guilleiguaran guilleiguaran authored
Showing with 17 additions and 1 deletion.
  1. +1 −0  Gemfile
  2. +7 −0 Gemfile.lock
  3. +9 −1 config/initializers/carrierwave.rb
View
1  Gemfile
@@ -36,6 +36,7 @@ gem 'magent', :git => 'http://github.com/dcu/magent.git'
#File uploading
gem 'carrierwave', :git => 'git://github.com/rsofaer/carrierwave.git' , :branch => 'master' #Untested mongomapper branch
gem 'mini_magick'
+gem 'aws'
group :test, :development do
gem 'factory_girl_rails'
View
7 Gemfile.lock
@@ -99,6 +99,10 @@ GEM
arel (1.0.1)
activesupport (~> 3.0.0)
autotest (4.3.2)
+ aws (2.3.21)
+ http_connection
+ uuidtools
+ xml-simple
bcrypt-ruby (2.1.2)
bson (1.0.7)
bson_ext (1.0.7)
@@ -126,6 +130,7 @@ GEM
haml (3.0.18)
hashie (0.4.0)
highline (1.6.1)
+ http_connection (1.3.1)
i18n (0.4.1)
json (1.4.6)
lsof (0.3.0)
@@ -218,6 +223,7 @@ GEM
rack (>= 1.0)
rack-test (>= 0.5.3)
will_paginate (3.0.pre2)
+ xml-simple (1.0.12)
PLATFORMS
ruby
@@ -225,6 +231,7 @@ PLATFORMS
DEPENDENCIES
addressable
autotest
+ aws
bson (= 1.0.7)
bson_ext (= 1.0.7)
bundler (= 1.0.0)
View
10 config/initializers/carrierwave.rb
@@ -3,5 +3,13 @@
# the COPYRIGHT file.
CarrierWave.configure do |config|
- config.storage = :file
+ if ENV['S3_KEY'] && ENV['S3_SECRET'] && ENV['S3_BUCKET']
+ config.storage = :s3
+ config.s3_access_key_id = ENV['S3_KEY']
+ config.s3_secret_access_key = ENV['S3_SECRET']
+ config.s3_bucket = ENV['S3_BUCKET']
+ config.cache_dir = "#{Rails.root}/tmp/uploads"
+ else
+ config.storage = :file
+ end
end
Please sign in to comment.
Something went wrong with that request. Please try again.