I am using a YAML file to store sensitive configuration data. I just use this file in a development environment. In production, I use ENV variables.
Here is what I am doing right now:
I have a config / authorizedal.yml file that looks like this:
email: user_name: 'my_user' password: 'my_passw'
I have a config / environment / development.rb file that (among other things) has the following lines:
# Mailer config email_confidential = YAML.load_file("#{Rails.root}/config/confidential.yml")['email'] config.action_mailer.delivery_method = :smtp config.action_mailer.smtp_settings = { :address => "smtp.gmail.com", :port => 587, :domain => 'baci.lindsaar.net', :user_name => email_confidential['user_name'], :password => email_confidential['password'], :authentication => 'plain', :enable_starttls_auto => true }
My question is: how can I make sure that the YAML file exists and can be loaded, and if I did not select some exception? Where should it be delivered?
source share