Giter VIP home page Giter VIP logo

carrierwave-aliyun's Introduction

CarrierWave for Aliyun OSS

This gem adds support for Aliyun OSS to CarrierWave

  • Gem Version

Installation

gem install carrierwave-aliyun

Using Bundler

gem 'rest-client'
gem 'carrierwave-aliyun'

Configuration

创建这么个脚本 config/initializes/carrierwave.rb 填入下面的代码,并修改对应的配置:

CarrierWave.configure do |config|
  config.storage           = :aliyun
  config.aliyun_access_id  = "xxxxxx"
  config.aliyun_access_key = 'xxxxxx'
  # 你需要在 Aliyum OSS 上面提前创建一个 Bucket
  config.aliyun_bucket     = "simple"
  # 是否使用内部连接,true - 使用 Aliyun 局域网的方式访问  false - 外部网络访问
  config.aliyun_internal   = true
  # 配置存储的地区数据中心,默认: cn-hangzhou
  # config.aliyun_area     = "cn-hangzhou"
  # 使用自定义域名,设定此项,carrierwave 返回的 URL 将会用自定义域名
  # 自定于域名请 CNAME 到 you_bucket_name.oss.aliyuncs.com (you_bucket_name 是你的 bucket 的名称)
  config.aliyun_host       = "http://foo.bar.com"
  # 如果有需要,你可以自己定义上传 host, 比如阿里内部的上传地址和 Aliyun OSS 对外的不同,可以在这里定义,没有需要可以不用配置
  # config.aliyun_upload_host = "http://you_bucket_name.oss.aliyun-inc.com"
end

跳过 CarrierWave 直接调用 Aliyun API

如果你有需求想跳过 CarrierWave,直接调用 Aliyun 的接口,可以参看 spec/aliyun_spec.rb 里面有例子。

carrierwave-aliyun's People

Contributors

huacnlee avatar victorteokw avatar aligo avatar wxianfeng avatar sishen avatar hayeah avatar poiyzy avatar giaogiaocat avatar zhangtenghai avatar

Watchers

James Cloos avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.