Paperclip, fog .io and Rackspace

I am trying to find documentation on how to configure Paperclip to use fog.io and fog.io to use the Rackspace Cloud File, but I could not find a good link (and consider myself a good Google speaker language: D). The ideal scenario is a setup in which I could use local storage for the development environment and Rackspace for production.

Can someone point to a good document or use this space to document this approach?

Tks!

== Update ==:

Paper clip for fog.io

https://github.com/thoughtbot/paperclip/blob/master/lib/paperclip/storage/fog.rb

fog.io to Rackspace Cloud File

http://fog.io/storage/

... still trying to figure out how to combine them.

+6
source share
1 answer

I think I get it.

In config / initializers / paperclip_defaults.rb

Paperclip::Attachment.default_options.update({ :path => "images/:class/:id/:attachment/:style/img_:fingerprint", :storage => :fog, :fog_credentials => { :provider => 'Rackspace', :rackspace_username => 'blablabla', :rackspace_api_key => 'blablabla', :persistent => false }, :fog_directory => 'blablabla', :fog_public => true, :fog_host => 'http://blablabla.rackcdn.com' }) 

Where...

: fog_directory . This is your Rackspace cloud storage container.

: fog_host - CDN URL of the cloud file

: permanent . To prevent an error in Fog / Excon. You may not need this in the future.

Also use the : fingerprint clip function to avoid caching CDN when updating a file.

+11
source

Source: https://habr.com/ru/post/901833/


All Articles