fix: defaults for postgres fixed

This commit is contained in:
2026-07-30 10:29:03 +02:00
parent b0e6e87320
commit cf0539821b
+7 -6
View File
@@ -8,12 +8,13 @@ read -p "Postgres DB name (default = postgres) " dbname
read -p "Postgres DB username (default = postgres) " dbuser
read -p "Postgres DB password (default = postgres) " dbpw
if [[ $port == "" ]]; then
port=5432
fi
port=${port:-5432}
dbname=${dbname:-postgres}
dbuser=${dbuser:-postgres}
dbpw=${dbpw:-postgres}
if [[ $2 ]]; then
read -p "Do you wish to mount the data directory to $2/pgdata? (y/N)" domount
read -p "Do you wish to mount the data directory to $2/pgdata? (y/N) " domount
if [[ $domount == "y" ]]; then
mountarg="-v $2/pgdata:/var/lib/postgresql/data"
@@ -28,11 +29,11 @@ echo "
=> Starting container with port $port
"
docker run --rm \
docker run \
$mountarg \
-p $port:5432 \
-e POSTGRES_USER=$dbuser \
-e POSTGRES_PASSWORD=$dbpw \
-e POSTGRES_DB=$dbname \
--name $name \
postgres
postgres &