How to set up database.yml file for not failing new suspenders project

When I make suspenders app, it fails because database.yml file is missing username and password.
So I add username and password using dotenv and add some code to databes.yml file.
username: <%= ENV[“USERNAME”] %>
password: <%= ENV[“PASSWORD”] %>

This works great!

However, I want to make it work without doing extra job.
Can someone give me a direction to solve this problem?


If you don’t specify a username and password then I think it defaults to using the root (or maybe postgres?) account, with a blank password. So you probably just need to create that, and give it the appropriate permissions.

You can configure PostgreSQL to trust specific users on localhost, root included.

When I create a new suspenders project the default database.yml file does not need to be altered. I believe this this the desired behavior.

Your comment help me to move to right direction!!

I also thought database.yml shouldn’t be altered.
Thank you for the link. This solved my problem!!

1 Like

If someone have same question as me, this gist might be helpful.