Denis Romanovsky
Denis Romanovsky

Reputation: 298

Community engine and AWS s3 for photo uploads

I`m trying to configure the community gem to use s3. The docs say only: You'll need to change your configuration in your application_config.rb to tell CommunityEngine to use s3 as the photo backend.

Anyone knows what and how to change? Do I need any additional gems, config files?

Upvotes: 0

Views: 18

Answers (1)

Denis Romanovsky
Denis Romanovsky

Reputation: 298

Answering my own question, I`ve found two ways: 1. Find and edit\ monkey-patch the file application_config.rb of the gem itself.(I have vendorized the gem.) 2. Override the configs in a usual way, like the gem creators advise.

The config itself should be like this:

:photo => {
    :missing_thumb => 'icon_missing_thumb.gif',
    :missing_medium => "icon_missing_medium.gif",
    :paperclip_options => {
      storage: 's3',
      s3_credentials: {
        use_persistent: true,
        :bucket => "bucket_name",
        :endpoint => 'bucket_name.s3.amazonaws.com',
        :access_key_id => "key",
        :secret_access_key => "secret_key",
        s3_host_name: "host_name"},
      :default_url => "",

I`ve added the s3_credentials section and storage: 's3' line.

Upvotes: 0

Related Questions