lib/carrierwave/storage/aliyun.rb in carrierwave-aliyun-0.2.1 vs lib/carrierwave/storage/aliyun.rb in carrierwave-aliyun-0.3.0

- old
+ new

@@ -12,17 +12,18 @@ class Connection def initialize(options={}) @aliyun_access_id = options[:aliyun_access_id] @aliyun_access_key = options[:aliyun_access_key] @aliyun_bucket = options[:aliyun_bucket] + @aliyun_area = options[:aliyun_area] || 'cn-hangzhou' # Host for upload - @aliyun_upload_host = "#{@aliyun_bucket}.oss.aliyuncs.com" + @aliyun_upload_host = "#{@aliyun_bucket}.oss-#{@aliyun_area}.aliyuncs.com" if options[:aliyun_internal] == true - @aliyun_upload_host = "#{@aliyun_bucket}.oss-internal.aliyuncs.com" + @aliyun_upload_host = "#{@aliyun_bucket}.oss-#{@aliyun_area}-internal.aliyuncs.com" end # Host for get request - @aliyun_host = options[:aliyun_host] || "#{@aliyun_bucket}.oss.aliyuncs.com" + @aliyun_host = options[:aliyun_host] || "#{@aliyun_bucket}.oss-#{@aliyun_area}.aliyuncs.com" end =begin rdoc 上传文件 @@ -183,9 +184,10 @@ return @oss_connection if @oss_connection config = { :aliyun_access_id => @uploader.aliyun_access_id, :aliyun_access_key => @uploader.aliyun_access_key, + :aliyun_area => @uploader.aliyun_area, :aliyun_bucket => @uploader.aliyun_bucket, :aliyun_internal => @uploader.aliyun_internal, :aliyun_host => @uploader.aliyun_host } @oss_connection ||= CarrierWave::Storage::Aliyun::Connection.new(config)