Sha256: 409b8fd41a7be589ff638c3c7d14666dd93e3948c494af9c963cd99f59e2366a

Contents?: true

Size: 1.29 KB

Versions: 4

Compression:

Stored size: 1.29 KB

Contents

CarrierWave.configure do |config|

  config.cache_dir = File.join(Rails.root, 'tmp', 'uploads')

  case Rails.env.to_sym

  when :development
    config.storage = :file
    config.root = File.join(Rails.root, 'public')

  when :production
    # WARNING: add the "carrierwave-aws" gem in your Rails app Gemfile.
    # More information here: https://github.com/sorentwo/carrierwave-aws

    config.storage          = :aws
    config.aws_bucket       = ENV['S3_BUCKET']
    config.aws_acl          = 'public-read'

    config.aws_credentials  = {
      access_key_id:      ENV['S3_KEY_ID'],
      secret_access_key:  ENV['S3_SECRET_KEY'],
      region:             ENV['S3_BUCKET_REGION']
    }

    # Use a different endpoint (eg: another provider such as Exoscale)
    if ENV['S3_ENDPOINT'].present?
      config.aws_credentials[:endpoint] = ENV['S3_ENDPOINT']
    end

    # For some endpoint like minio you need to rewrite path 
    if ENV['S3_PATH_STYLE'].present?
      config.aws_credentials[:force_path_style] = ENV['S3_PATH_STYLE']
    end

    # Put your CDN host below instead
    if ENV['S3_ASSET_HOST_URL'].present?
      config.asset_host = ENV['S3_ASSET_HOST_URL']
    end

  else
    # settings for the local filesystem
    config.storage = :file
    config.root = File.join(Rails.root, 'public')
  end

end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
locomotivecms-4.2.0.alpha2 lib/generators/locomotive/install/templates/carrierwave_aws.rb
locomotivecms-4.2.0.alpha1 lib/generators/locomotive/install/templates/carrierwave_aws.rb
locomotivecms-4.1.1 lib/generators/locomotive/install/templates/carrierwave_aws.rb
locomotivecms-4.1.0 lib/generators/locomotive/install/templates/carrierwave_aws.rb