forked from carrierwaveuploader/carrierwave
-
Notifications
You must be signed in to change notification settings - Fork 2
How to: Migrate to the new Fog storage provider
clyfe edited this page May 27, 2011
·
6 revisions
h4. Migrating to the new Fog storage provider:
Old s3 example:
CarrierWave.configure do |config|
config.s3_access_key_id = 'xxx'
config.s3_secret_access_key = 'yyy'
config.s3_bucket = 'name_of_bucket'
config.s3_access_policy = :public_read
config.s3_headers = {'Cache-Control' => 'max-age=315576000'}
config.s3_region = 'us-east-1'
config.s3_cnamed = true
end
class AvatarUploader < CarrierWave::Uploader::Base
storage :s3
end
New fog s3 example:
CarrierWave.configure do |config|
config.fog_credentials = {
:provider => 'AWS',
:aws_access_key_id => 'xxx',
:aws_secret_access_key => 'yyy',
:region => 'us-east-1'
}
config.fog_directory = 'name_of_bucket'
config.fog_host = 'https://assets.example.com'
config.fog_public = true
config.fog_attributes = {'Cache-Control' => 'max-age=315576000'}
end
class AvatarUploader < CarrierWave::Uploader::Base
storage :fog
end
Old cloudfiles example:
CarrierWave.configure do |config|
config.cloud_files_username = 'xxx'
config.cloud_files_api_key = 'yyy'
config.cloud_files_container = 'name_of_container'
config.cloud_files_cdn_host = "c000000.cdn.rackspacecloud.com"
end
class AvatarUploader < CarrierWave::Uploader::Base
storage :cloudfiles
end
New fog cloudfiles example:
CarrierWave.configure do |config|
config.fog_credentials = {
:provider => 'Rackspace',
:rackspace_username => 'xxxxxxxxx',
:rackspace_api_key => 'yyyyyyyyy'
}
config.fog_directory = 'name_of_container'
config.fog_host = "c000000.cdn.rackspacecloud.com"
end
class AvatarUploader < CarrierWave::Uploader::Base
storage :fog
end