On 29 July 2012 11:28, Michael Pearson <[email protected]> wrote: > For instance, it'd be nice if I could have on my system: > > DATABASE_URI=mysql://foo:bar@localhost/myDatabase > > And then keep application specific database config (eg, my locale) to the > database.yml. > > I'm wondering if anybody has implemented this already in a gem, or a gist, > or similar. It's relatively trivial to use ERB to do this in your > database.yml right now, but seems inelegant. > > Also, I hate ERB. Just putting that out there. >
With regards to the database connection, I'm using the Postgres' password file: http://www.postgresql.org/docs/9.1/static/libpq-pgpass.html Avoid environment variables for that because: "PGPASSWORD sets the password used if the server demands password authentication. Use of this environment variable is not recommended for security reasons (some operating systems allow non-root users to see process environment variables via ps); instead consider using the ~/.pgpass file" Similar thing seems to be available for MySQL as an "option file" http://dev.mysql.com/doc/refman/5.0/en/option-files.html The Chef provisions those files from the config which is never stored in VCS (maybe as an example only). It is either on CI or somewhere in safe place. Then the database.yml would only have to include the username (<app_name>_<environment> for me) and the database with no sensitive data in it. Thus all apps that need to access the DB only need to be running as correct users. That's the setup that works for me. Cheers. -- You received this message because you are subscribed to the Google Groups "Ruby or Rails Oceania" group. To post to this group, send email to [email protected]. To unsubscribe from this group, send email to [email protected]. For more options, visit this group at http://groups.google.com/group/rails-oceania?hl=en.
