Skip to content
This repository

added option to configure aws key and secret via ENV #62

Merged
merged 1 commit into from about 2 years ago

2 participants

Henk van der Veen Nathan Colgate
Henk van der Veen

Especially for deployment on heroku this is a nice way of not having your key and secret in the repository.

Henk van der Veen

The names for the settings are the same as asset_sync gem.

Nathan Colgate nathancolgate merged commit 76f36fa into from March 07, 2012
Nathan Colgate nathancolgate closed this March 07, 2012
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Showing 1 unique commit by 1 author.

Mar 07, 2012
Henk van der Veen added option to configure aws key and secret via ENV 280c6ff
This page is out of date. Refresh to see the latest.
1  README.textile
Source Rendered
@@ -34,6 +34,7 @@ h2. Usage
34 34
 If you are using Rails 3.1, you will need to move the generated s3_upload.js from the public/javascripts directory to the app/assets/javascripts directory.
35 35
 	
36 36
 4. Configure your amazon parameters via the generated <code>config/amazon_s3.yml</code> file.
  37
+(key and secret can optionally be removed from that file and configured via <code>ENV['AWS_ACCESS_KEY_ID']</code> and <code>ENV['AWS_SECRET_ACCESS_KEY']</code>)
37 38
 
38 39
 5. Make the bucket
39 40
 
4  lib/s3_swf_upload/s3_config.rb
@@ -18,8 +18,8 @@ def self.load_config
18 18
           raise "Could not load config options for #{Rails.env} from #{filename}."
19 19
         end
20 20
 
21  
-        @@access_key_id     = config['access_key_id']
22  
-        @@secret_access_key = config['secret_access_key']
  21
+        @@access_key_id     = config['access_key_id'] || ENV['AWS_ACCESS_KEY_ID']
  22
+        @@secret_access_key = config['secret_access_key'] || ENV['AWS_SECRET_ACCESS_KEY']
23 23
         @@bucket            = config['bucket']
24 24
         @@max_file_size     = config['max_file_size']
25 25
         @@acl               = config['acl'] || 'private'
Commit_comment_tip

Tip: You can add notes to lines in a file. Hover to the left of a line to make a note

Something went wrong with that request. Please try again.