Skip to content

Instantly share code, notes, and snippets.

@insignia
Forked from luislavena/paperclip.rb
Created June 2, 2009 22:08
Show Gist options
  • Save insignia/122627 to your computer and use it in GitHub Desktop.
Save insignia/122627 to your computer and use it in GitHub Desktop.
# Load config/paperclip.yml settings
if paperclip_cfg = YAML.load_file("#{Rails.root}/config/paperclip.yml")[Rails.env]
paperclip_cfg.symbolize_keys!
command_path = paperclip_cfg.delete(:command_path)
# Replace Attachment defaults with configuration ones
Paperclip::Attachment.default_options.merge!(paperclip_cfg)
# Adjust ImageMagick path to work with Passenger
Paperclip.options[:command_path] = command_path
end
common: &local_settings
storage: :filesystem
url: "/system/:class/:attachment/:id_partition/:basename_:style.:extension"
command_path: /opt/local/bin
s3_amazon: &s3_settings
<<: *local_settings
storage: :s3
s3_credentials: config/s3.yml
path: ":class/:attachment/:id_partition/:basename_:style.:extension"
url: ":s3_domain_url"
cloudfront: &cloud_settings
<<: *s3_settings
url: ":s3_alias_url"
development:
<<: *local_settings
staging:
<<: *cloud_settings
bucket: assets-bucket
s3_host_alias: assets.domain.com
command_path: /usr/bin
production:
<<: *local_settings
command_path: /usr/bin
access_key_id: ...
secret_access_key: ...
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment