fix: defaults for postgres fixed
This commit is contained in:
+19
-18
@@ -8,31 +8,32 @@ read -p "Postgres DB name (default = postgres) " dbname
|
|||||||
read -p "Postgres DB username (default = postgres) " dbuser
|
read -p "Postgres DB username (default = postgres) " dbuser
|
||||||
read -p "Postgres DB password (default = postgres) " dbpw
|
read -p "Postgres DB password (default = postgres) " dbpw
|
||||||
|
|
||||||
if [[ $port == "" ]]; then
|
port=${port:-5432}
|
||||||
port=5432
|
dbname=${dbname:-postgres}
|
||||||
fi
|
dbuser=${dbuser:-postgres}
|
||||||
|
dbpw=${dbpw:-postgres}
|
||||||
|
|
||||||
if [[ $2 ]]; then
|
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
|
if [[ $domount == "y" ]]; then
|
||||||
mountarg="-v $2/pgdata:/var/lib/postgresql/data"
|
mountarg="-v $2/pgdata:/var/lib/postgresql/data"
|
||||||
else
|
else
|
||||||
mountarg=""
|
mountarg=""
|
||||||
fi
|
fi
|
||||||
else
|
else
|
||||||
mountarg=""
|
mountarg=""
|
||||||
fi
|
fi
|
||||||
|
|
||||||
echo "
|
echo "
|
||||||
=> Starting container with port $port
|
=> Starting container with port $port
|
||||||
"
|
"
|
||||||
|
|
||||||
docker run --rm \
|
docker run \
|
||||||
$mountarg \
|
$mountarg \
|
||||||
-p $port:5432 \
|
-p $port:5432 \
|
||||||
-e POSTGRES_USER=$dbuser \
|
-e POSTGRES_USER=$dbuser \
|
||||||
-e POSTGRES_PASSWORD=$dbpw \
|
-e POSTGRES_PASSWORD=$dbpw \
|
||||||
-e POSTGRES_DB=$dbname \
|
-e POSTGRES_DB=$dbname \
|
||||||
--name $name \
|
--name $name \
|
||||||
postgres
|
postgres &
|
||||||
|
|||||||
Reference in New Issue
Block a user