Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Paperclip Rails initializer to store data on the European S3 server using Fog.
# config/initializers/01_paperclip.rb
if Rails.env.production?
Paperclip::Attachment.default_options.merge!(
storage: :fog,
fog_directory: 'lazy-enterprise',
fog_host: 'https://s3-eu-west-1.amazonaws.com/lazy-enterprise',
fog_public: true,
fog_credentials: {
provider: 'AWS',
aws_access_key_id: ENV['S3_ID'],
aws_secret_access_key: ENV['S3_KEY'],
region: 'eu-west-1'
}
)
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment