Connect to Production Database - Explicit password on database.yml?

Hi there,

What is a good way to setup connection to production database? Do I really need to keep production password on database.yml file? Are there any other ways?

Thanks in advance, Leandro

In database.yml use something like   password: <%= ENV['MY_DATABASE_PASSWORD'] %> and externally setup an environment variable MY_DATABASE_PASSWORD

I believe that is what rails new ... generates automatically. Did it not for you?

Colin

It looks it did, but my app still is not connecting. Looks like I’m missing something.

I created the database with:

rake db:create RAILS_ENV=production

But when I try to run the app, production.log gives me the error:

**PG Peer authentication failed for user “myusername” **

I’ve tried to add host:localhost to my config/database.yml, and now it gives me this error:

Try first with the password explicitly in database.yml, then when that is working use an environment variable instead.

Colin