ruby on rails - How to read yml file uploaded to aws s3 -
ruby on rails - How to read yml file uploaded to aws s3 -
i have yml file containing credentials , keys. security wondered if upload s3 , access using private url or via aws object.
i tried giving url in development.rb load file didn't work.
next tried creating aws object , access file in s3 bucket.
s3 = aws::s3.new(access_ key_id: 'xxx', secret_access_key: 'yyy') s3.buckets['my-bucket'].objects['file_name.yml']
i tried putting url, file name without .yml access file , read it. keeps returning me empty {}
. have url/file permission?? how can accomplish this?
this first time using aws , not sure if approach right or if best way maintain sensitive info safe. plz guide me on how accomplish this.
thanks
i utilize next gem this, much improve yaml implementation.
https://github.com/bkeepers/dotenv
install , add together to gemfile.
then vim .env
or create new file using editor of choice.
add keys:
s3_bucket=yours3bucket secret_key=yoursecretkeygoeshere
and save it.
you can phone call application wherever need s3 keys.
env['s3_bucket'] env['secret_key']
once pushed heorku, updated environment variables, no need force secrets github.
ruby-on-rails amazon-s3 aws-sdk
Comments
Post a Comment