./run psql: connect to specified database#66
Conversation
|
Hi,
I didn't test this locally but if |
|
Yes, it produces docker compose exec postgres psql -d -U postgresIt results in I can modify the script to specify |
|
I updated the script to include |
That is what I thought would happen since it tries to pass |
|
I'd have to also test this but I think Docker Compose now supports the same type of nested variable interpolation with a default so we can also do the same in the Do you want to test that? |
…ES_DB is not specified
Did the change and seems to work based on testing 👍 |
./run psqlcommand now connects to database that has been set in.env. By default the postgres image usesPOSTGRES_USERas db name ifPOSTGRES_DBis not specified and likewisepsql -U [user_name]connects to database[user_name]if database has not been specified with-dflag.This fixes the issue where username and database name differ.
Note that if
POSTGRES_DBis commented out / does not exist in.env, then the script works the old way (psql -U [user_name]).