Post by Peter Cooper on January 26th, 2007

Request Database Authentication When Rails Starts

Dbsafe

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).

[Post to Twitter] Tweet This

3 Responses to “Request Database Authentication When Rails Starts”

  1. #1
    Dejan Dimic Says:

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

  2. #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. #3
    Hendy Irawan Says:

    Wow...

    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)