In our rails app, we would like to load the mail server configuration during the startup. Here is the what we have in config/environment/development.rb:
#Action Mailer
config.action_mailer.smtp_settings = eval(Authentify::AuthentifyUtility.find_config_const('development_smtp_setting'))
The Authentify::AuthentifyUtility.find_config_const('development_smtp_setting')
shall return:
{
:address => "mymail.com",
:port => 587,
:user_name => "smtp_login_name",
:password => "password",
:authentication => :plain,
:enable_starttls_auto => false
}
However rails server
throws out error:
activerecord-3.2.12/lib/active_record/connection_adapters/abstract/connection_pool.rb:410:in `retrieve_connection'
: ActiveRecord::ConnectionNotEstablished (ActiveRecord::ConnectionNotEstablished)
It seems that there is no db connection during the load time. What's the right way to load the mail server config? Thanks.