brillo icon indicating copy to clipboard operation
brillo copied to clipboard

Brillo doesn't respect `DATABASE_URL`

Open toothbrush opened this issue 2 years ago • 0 comments

If i understand correctly, in Rails land, an entry in config/database.yml like development.url will typically take precedence over the user and password settings there. Typically this is passed via a DATABASE_URL environment variable to make an app closer to 12-factor ideals.

I dockerised a Rails app recently, which mostly worked well, but i couldn't figure out where this command was coming from:

cat /myproj/tmp/myproj-scrubbed.dmp | PGPASSWORD={FILTERED} psql --host localhost -U myproj myproj_development

The thing is, in development i am running the app in docker-compose.yml with a postgres sibling container, so the hostname needs to be postgres instead of localhost (unless i set network.host: true but i don't want to do that just yet).

It turned out that this line of code came from here:

https://github.com/bessey/brillo/blob/6c9110b6b393a23d1d1f72aa45e16e27b4b49a35/lib/brillo/adapter/postgres.rb#L4-L10

It seems to me that it's a bug in Brillo if the database url property is being ignored if it's set.

toothbrush avatar Sep 26 '22 16:09 toothbrush