CarrierWave::S3cn
TODO: Write a gem description
Installation
Add this line to your application's Gemfile:
gem 'carrierwave-s3cn'
And then execute:
$ bundle
Or install it yourself as:
$ gem install carrierwave-s3cn
Usage
You'll need to configure it in config/initializes/carrierwave.rb
::CarrierWave.configure do |config|
config.storage = :s3cn
config.s3cn_region = "cn-north-1"
config.s3cn_endpoint = ''
config.s3cn_bucket = "s3 bucket name"
config.s3cn_access_key_id = "中国 s3 access_key_id"
config.s3cn_secret_access_key = "中国 s3 secret_access_key"
config.s3cn_bucket_private = true
config.s3cn_protocol = "https"
end
For more information on qiniu, please read http://docs.aws.amazon.com/general/latest/gr/isolated_regions.html
And then in your uploader, set the storage to :qiniu
:
class AvatarUploader < CarrierWave::Uploader::Base
storage :s3cn
end
You can override configuration item in individual uploader like this:
class AvatarUploader < CarrierWave::Uploader::Base
storage :s3cn
self.s3cn_bucket = "avatars"
self.s3cn_access_key_id = ""
self.s3cn_secret_access_key = ''
self.qiniu_bucket_private= true
end
You can see a example project on: https://github.com/dekexu/carrierwave-s3cn
or see the spec test on https://github.com/dekexu/carrierwave-s3cn
Contributing
- Fork it ( https://github.com/dekexu/carrierwave-s3cn/fork )
- Create your feature branch (
git checkout -b my-new-feature
) - Commit your changes (
git commit -am 'Add some feature'
) - Push to the branch (
git push origin my-new-feature
) - Create a new Pull Request