paperclip_heroku
One-line S3 storage setup for Paperclip on Heroku.
Usage:
class User
has_attached_file :avatar, heroku: true
end
Using heroku: true
configures Paperclip to use Amazon S3 on Heroku and the filesystem in development/testing.
Configuration
S3 storage config can be set on the command line, like this:
$ heroku config:add S3_BUCKET=my_bucket_name
$ heroku config:add S3_KEY=my_s3_access_key_id
$ heroku config:add S3_SECRET=my_s3_secret_access_key
You can also optionally set a S3_HOST_NAME to specify an endpoint for S3 requests: for example, if your S3 bucket is in the US West (Oregon) region, you should set S3_HOST_NAME to 's3-us-west-2.amazonaws.com'. If not set, this will default to s3.amazonaws.com. See Amazon's docs for a list of valid hostnames/endpoints.
Environments
By default, paperclip_heroku assumes you want to use S3 in production. To override this:
$ heroku config:add S3_ENVIRONMENT=staging
Multiple environments are also supported:
$ heroku config:add S3_ENVIRONMENT=staging,production
Author
Developed by James Wilding. Released under the MIT license.