From 5e18438f4cb29039108be6fc2aa548af541dce3a Mon Sep 17 00:00:00 2001 From: Michael A <93111434+aldalen@users.noreply.github.com> Date: Wed, 2 Jul 2025 14:22:08 -0700 Subject: [PATCH] Update docker entry point parsing to handle postgres query paramaters (#12937) This PR fixes the database name check to ignore query params. This is useful for situations where you need to force sslmode, like ?sslmode=require. Yarn seems to handle this, but this db creation check fails. My environment enforces ssl for all PG connections, so I need twenty to handle this check for me to test it locally. --- packages/twenty-docker/twenty/entrypoint.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/twenty-docker/twenty/entrypoint.sh b/packages/twenty-docker/twenty/entrypoint.sh index 51c2ebac8..999049125 100755 --- a/packages/twenty-docker/twenty/entrypoint.sh +++ b/packages/twenty-docker/twenty/entrypoint.sh @@ -12,7 +12,7 @@ setup_and_migrate_db() { PGPASS=$(echo $PG_DATABASE_URL | awk -F ':' '{print $3}' | awk -F '@' '{print $1}') PGHOST=$(echo $PG_DATABASE_URL | awk -F '@' '{print $2}' | awk -F ':' '{print $1}') PGPORT=$(echo $PG_DATABASE_URL | awk -F ':' '{print $4}' | awk -F '/' '{print $1}') - PGDATABASE=$(echo $PG_DATABASE_URL | awk -F ':' '{print $4}' | awk -F '/' '{print $2}') + PGDATABASE=$(echo $PG_DATABASE_URL | awk -F '/' '{print $NF}' | cut -d'?' -f1) # Creating the database if it doesn't exist db_count=$(PGPASSWORD=${PGPASS} psql -h ${PGHOST} -p ${PGPORT} -U ${PGUSER} -d postgres -tAc "SELECT COUNT(*) FROM pg_database WHERE datname = '${PGDATABASE}'")