[FIX] URLEncode PSQL Password (#219)

* URL Encode the Postgres password, allowing for special characters in the connection string
This commit is contained in:
Dave Lasley authored and Kyâne Pichou committed 2018-01-05 19:26:44 +01:00
1 parent dfe76684f4
commit 8bb026133d
1 file changed
+3 -1
+3 -1
View File
@@ -58,7 +58,9 @@ if [ "$1" = 'platform' ]; then
if [ -z "$MM_SQLSETTINGS_DATASOURCE" ] if [ -z "$MM_SQLSETTINGS_DATASOURCE" ]
then then
echo -ne "Configure database connection..." 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 echo OK
else else
echo "Using existing database connection" echo "Using existing database connection"