From 8bb026133d7da58456c0eb11976738f90c787b30 Mon Sep 17 00:00:00 2001 From: Dave Lasley Date: Fri, 5 Jan 2018 10:26:44 -0800 Subject: [PATCH] [FIX] URLEncode PSQL Password (#219) * URL Encode the Postgres password, allowing for special characters in the connection string --- app/entrypoint.sh | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/app/entrypoint.sh b/app/entrypoint.sh index ccb17bd..88e3143 100755 --- a/app/entrypoint.sh +++ b/app/entrypoint.sh @@ -58,7 +58,9 @@ if [ "$1" = 'platform' ]; then if [ -z "$MM_SQLSETTINGS_DATASOURCE" ] then echo -ne "Configure database connection..." - export MM_SQLSETTINGS_DATASOURCE="postgres://$MM_USERNAME:$MM_PASSWORD@$DB_HOST:$DB_PORT_NUMBER/$MM_DBNAME?sslmode=disable&connect_timeout=10" + # URLEncode the password, allowing for special characters + ENCODED_PASSWORD=$(printf %s $MM_PASSWORD | jq -s -R -r @uri) + export MM_SQLSETTINGS_DATASOURCE="postgres://$MM_USERNAME:$ENCODED_PASSWORD@$DB_HOST:$DB_PORT_NUMBER/$MM_DBNAME?sslmode=disable&connect_timeout=10" echo OK else echo "Using existing database connection"