I would like to do something like this in my amazon_s3.yml config file:
access_key_id: ENV['S3_KEY']
secret_access_key: ENV['S3_SECRET']
…but I know this isn’t working. Not sure if it is even possible, but can you put Ruby code in a YAML file?
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
Not normally / directly. I say this because in order to use ruby results you need to use something like ERB first before loading the file. In terms of code, you need to go from something like:
Or even
To:
In this specific case, you would have to look at what is loading the file – in some cases,
it may already be designed to load it straight out of the environment or you may need to either:
Since there are a few plugins that use amazon_s3.yml, It might be worth posting which library you are using that uses it – alternatively, I believe from a quick google that the AWS library lets you define AMAZON_ACCESS_KEY_ID and AMAZON_SECRET_ACCESS_KEY as env vars and it will pick them up out of the box.