amazon s3 - Ruby on Rails, Paperclip, Heroku, GitHub and AWS - securing keys -
i'm using ror hosted heroku , i'd store files on s3 using paperclip. source code hosted on github , world readable. best practice keep keys secret rest of world?
paperclip suggests access keys stored in configuration file (or in code), example have:
file: config/s3.yml
access_key_id: my_access_key_id secret_access_key: my_very_secret_key bucket: bucket_name
heroku works committing code local git , pushing heroku. since i'm using github, push same code github well. means push secret keys there too.
i'm using world-readable github account, if payed github make half problem go away still i'm not happy secret keys lying in configuration file in code. don't know if there's better practice though.
what best practice keeping keys secret , still using above mentioned list of libraries , services?
btw, i've started ror , heroku last week may considered newbe, please considerate ;) thanks!
you need use env variable heroku app.
if heroku config can have access of env variable. add , use directly in application.
with trick don't need update code change configuration , configuration if not define in code base.
in s3.yml need :
access_key_id: <%= env['s3_access_key'] %> secret_access_key: <%= env['s3_secret_key'] %> bucket: <%= env['s3_bucket_name'] %>
and add env variable in heroku app
heroku config:add s3_access_key='your_key' heroku config:add s3_secret_key='your_secret' heroku config:add s3_bucket_name='your_nucket_name'
Comments
Post a Comment