Ruby Weekly is a weekly newsletter covering the latest Ruby and Rails news.

Request Database Authentication When Rails Starts

By Peter Cooper / January 26, 2007


Derek (usernamed perraultd) shows us how to rewrite your Rails application's database.yml file to manually prompt you for database authentication information when your Rails app starts. This might not be of much use in automated deployment environments, but it demonstrates the dynamism of the templating system (I didn't even realize database.yml was processed in this way).


  1. Dejan Dimic says:

    I am astonished.
    This new info on yaml processing will open a bunch of possibilities.
    Extremely interesting.

  2. Derek says:

    The manual prompt wouldn't work too hot for automated deployments, but if you decrypt a hashed password in database.yml, that would work.

    I just needed something very lightweight, but like Dejan Dimic said, there's a bunch of possibilities. :)

  3. Hendy Irawan says:


    But, being on the negative side, I can see automatically processing files using ERB (or anything that can "run code") without explicit request may be a... security concern. (for some people)

Other Posts to Enjoy

Twitter Mentions