From 388fcd8b70735b76d4c26b5e58529168fd381877 Mon Sep 17 00:00:00 2001 From: tobenna Date: Wed, 13 Mar 2024 23:41:03 +0000 Subject: [PATCH] fix: create url safe db passwords (#1799) --- cli/template/extras/start-database/mysql.sh | 3 ++- cli/template/extras/start-database/postgres.sh | 3 ++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/cli/template/extras/start-database/mysql.sh b/cli/template/extras/start-database/mysql.sh index 5564d101a1..61fbfe1f9b 100755 --- a/cli/template/extras/start-database/mysql.sh +++ b/cli/template/extras/start-database/mysql.sh @@ -35,7 +35,8 @@ if [ "$DB_PASSWORD" == "password" ]; then echo "Please set a password in the .env file and try again" exit 1 fi - DB_PASSWORD=$(openssl rand -base64 12) + # Generate a random URL-safe password + DB_PASSWORD=$(openssl rand -base64 12 | tr '+/' '-_') sed -i -e "s#:password@#:$DB_PASSWORD@#" .env fi diff --git a/cli/template/extras/start-database/postgres.sh b/cli/template/extras/start-database/postgres.sh index 56d2edd8d1..d2c3662f45 100755 --- a/cli/template/extras/start-database/postgres.sh +++ b/cli/template/extras/start-database/postgres.sh @@ -35,7 +35,8 @@ if [ "$DB_PASSWORD" = "password" ]; then echo "Please set a password in the .env file and try again" exit 1 fi - DB_PASSWORD=$(openssl rand -base64 12) + # Generate a random URL-safe password + DB_PASSWORD=$(openssl rand -base64 12 | tr '+/' '-_') sed -i -e "s#:password@#:$DB_PASSWORD@#" .env fi