Commit 23ee8e62 authored by Dmitriy Zaporozhets's avatar Dmitriy Zaporozhets

Init aws support for file storage

parent cde6b8e4
......@@ -57,6 +57,8 @@ gem "haml-rails"
# Files attachments
gem "carrierwave"
# for aws storage
# gem "fog", "~> 1.3.1"
# Authorization
gem "six"
......
# See https://github.com/jnicklas/carrierwave#using-amazon-s3
# for more options
production:
access_key_id: AKIA1111111111111UA
secret_access_key: secret
bucket: mygitlab.production.us
region: us-east-1
development:
access_key_id: AKIA1111111111111UA
secret_access_key: secret
bucket: mygitlab.development.us
region: us-east-1
test:
access_key_id: AKIA1111111111111UA
secret_access_key: secret
bucket: mygitlab.test.us
region: us-east-1
CarrierWave::SanitizedFile.sanitize_regexp = /[^[:word:]\.\-\+]/
aws_file = Rails.root.join('config', 'aws.yml')
if File.exists?(aws_file)
AWS_CONFIG = YAML.load(File.read(aws_file))[Rails.env]
config.fog_credentials = {
provider: 'AWS', # required
aws_access_key_id: AWS_CONFIG['access_key_id'], # required
aws_secret_access_key: AWS_CONFIG['secret_access_key'], # required
region: AWS_CONFIG['region'], # optional, defaults to 'us-east-1'
}
config.fog_directory = AWS_CONFIG['bucket'] # required
config.fog_public = false # optional, defaults to true
config.fog_attributes = {'Cache-Control'=>'max-age=315576000'} # optional, defaults to {}
end
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment