I'm trying to figure out what is the best way to set up my credentials in development? I'm able to set up credentials in production because of heroku's configuration variables... but need help doing so if you're just testing app locally.
I have this in my development.rb
config.paperclip_defaults = {
:storage => :s3,
:s3_credentials => {
:bucket => ENV['BUCKET_NAME'],
:access_key_id => ENV['ACCESS_KEY_ID'],
:secret_access_key => ENV['SECRET_ACCESS_KEY']
}
}
But, I'm not sure how to reference these ENV variables?
I created this aws.yml
file in my /config folder
development:
BUCKET_NAME: "somename"
ACCESS_KEY_ID: "4205823951412980"
SECRET_ACCESS_KEY: "123141ABNCEFEHUDSL2309489850"
I thought if I matched the ENV name, it'll work? I guess thats not the case...
I made sure to include aws.yml
to my .ignore
file
/config/aws.yml
You are looking for dotenv gem. Install the gem gem 'dotenv-rails', :groups => [:development, :test]
, then
just create and `.env' file and put the variables into it like this.
S3_BUCKET=YOURS3BUCKET
SECRET_KEY=YOURSECRETKEYGOESHERE
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With