require 'carrierwave'

CarrierWave.root = Rails.root.join(Rails.public_path).to_s
CarrierWave.base_path = ENV['RAILS_RELATIVE_URL_ROOT']

CarrierWave.configure do |config|
    config.storage = SampleApp::Application.config.storage_type
    config.fog_credentials = {
        :provider               => 'AWS',
        :aws_access_key_id      => SampleApp::Application.config.aws_access_key_id,
        :aws_secret_access_key  => SampleApp::Application.config.aws_secret_access_key,
        :region                 => SampleApp::Application.config.aws_region,
    }
    config.fog_directory  = SampleApp::Application.config.aws_bucket_public  # required
    config.fog_public     = true                                   # optional, defaults to true
    config.fog_attributes = {'Cache-Control'=>"max-age=#{SampleApp::Application.config.aws_cache}"}  # optional, defaults to {}
end


require 'carrierwave/orm/activerecord'
