I'm using Cloudinary to host and manage images of my rails 4+ app. Its api_secret
, api_keys
and other config is put into the production environment using a cloudinary.yml
file inside the config
folder.
Instead of a separate cloudinary.yml
file I wish to use the secrets.yml
file utility provided in rails 4+ to port the environment variables (various secret and keys) into the production environment. Intent is to keep it all at one place of my project and simply use a regular Capistrano recipe to deploy.
I wonder if there's a way to write on secrets.yml
like so:
production:
CL_CLOUD_NAME: MyAppName
CL_API_KEY: 'the_key'
CL_API_SECRET: the_secret
CL_ENHANCE_IMAGE_TAG: true/false
CL_STATIC_IMAGE_SUPPORT: true/false
CL_STATIC_SECURE: true/false
and be called in with $ cap production deploy
?
[Edits] Old question:
I wonder if there is a way to use an initializer inside ROOT/config/initializers/cloudinary.rb
where I can put lines something like this:
Cloudinary.configure do |c|
c.cloud_name = Rails.application.secrets.CL_CLOUD_NAME
c.api_key = Rails.application.secrets.CL_API_KEY
c.api_secret = Rails.application.secrets.CL_API_SECRET
c.secure = Rails.application.secrets.CL_STATIC_SECURE
end