Skip to content

Commit

Permalink
Change: Allow to set db user password for container
Browse files Browse the repository at this point in the history
For TCP access from the outside allow to set a password for the created
database user.
  • Loading branch information
bjoernricks committed Jul 25, 2023
1 parent bfb0632 commit c16d41c
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions .docker/start-postgresql.sh
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,11 @@ if [ -z "$USER_EXISTS" ]; then
createuser --host=/tmp -DRS "$POSTGRES_USER"
fi

if [ -n "$POSTGRES_PASSWORD" ]; then
echo "ALTER ROLE $POSTGRES_USER PASSWORD '$POSTGRES_PASSWORD';" | \
psql --host=/tmp -d postgres
fi

createdb --host=/tmp -O $POSTGRES_DB "$POSTGRES_USER"

psql --host=/tmp -d $POSTGRES_DB -c "create role dba with superuser noinherit;"
Expand Down

0 comments on commit c16d41c

Please sign in to comment.