diff options
author | Dmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com> | 2013-05-01 12:41:37 +0300 |
---|---|---|
committer | Dmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com> | 2013-05-01 12:41:37 +0300 |
commit | 23ee8e6257f09172e30c2bd6fd1d1fcd4d4e58b3 (patch) | |
tree | c5d2036615a247055d4af8f5ae6b1ccc8a37f5e7 | |
parent | cde6b8e4da6d086786a2c0adceb50eaa73485d4c (diff) | |
download | gitlab-ce-23ee8e6257f09172e30c2bd6fd1d1fcd4d4e58b3.tar.gz |
Init aws support for file storage
-rw-r--r-- | Gemfile | 2 | ||||
-rw-r--r-- | config/aws.yml.example | 19 | ||||
-rw-r--r-- | config/initializers/carrierwave.rb | 16 |
3 files changed, 37 insertions, 0 deletions
@@ -57,6 +57,8 @@ gem "haml-rails" # Files attachments gem "carrierwave" +# for aws storage +# gem "fog", "~> 1.3.1" # Authorization gem "six" diff --git a/config/aws.yml.example b/config/aws.yml.example new file mode 100644 index 00000000000..29d029b078d --- /dev/null +++ b/config/aws.yml.example @@ -0,0 +1,19 @@ +# 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 diff --git a/config/initializers/carrierwave.rb b/config/initializers/carrierwave.rb index 9bb62f6d55a..6659c1a1f7c 100644 --- a/config/initializers/carrierwave.rb +++ b/config/initializers/carrierwave.rb @@ -1 +1,17 @@ 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 |