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

Comments

  1. Dejan Dimic ·

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

  2. Derek ·

    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 ·

    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)