How to use enviroment variable instead cloudinary.yml
I'm following the tutorial:
http://railsapps.github.io/rails-environment-variables.html
to put all config in cloudinary.yml to environment variable on ubuntu.
I do it for reason security about api of cloudinary.
I used all of method on that tutorial but nothing worked.
I use rails console to test varialbe: ENV["cloud_name"] but the result => nil.
It means no key-value pair was push to enviroment varialbe.
Where's my wrong?
Please help, thanks
-
You can use the
CLOUDINARY_URL
env var as supplied in your Admin Console, and then access it withENV["CLOUDINARY_URL"]
0 -
Thanks, problem was resolved.
0 -
development:cloud_name: ENV["CLOUDINARY_URL"]api_key: ENV["CLOUDINARY_URL"]api_secret: ENV["CLOUDINARY_URL"]enhance_image_tag: truestatic_file_support: falseThis would be the way to go?0
-
Hi Javier,
As described in the doc Duyet shared above, you can use environment variables to create any key and store any value you'd like to use in your application.
ENV["CLOUDINARY_URL"] is meant to store the entire CLOUDINARY_URL variable. If you'd like to store the cloud name, API Key and API Secret as well, you'll have to use something like:cloud_name: ENV["CLOUD_NAME"]api_key: ENV["API_KEY"]api_secret: ENV["API_SECRET"]0
Post is closed for comments.
Comments
4 comments