Skip to content

Commit 698099d

Browse files
Update DB password if exists
Update DB password on boot in 2 container setup from env if exists
1 parent 136aefe commit 698099d

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

templates/postgres.template.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -263,6 +263,9 @@ run:
263263
su postgres -c 'psql $db_name -c "create extension if not exists vector;"'
264264
su postgres -c 'psql $db_name -c "alter extension vector update;"' || true
265265
sudo -u postgres psql $db_name <<< "update pg_database set encoding = pg_char_to_encoding('UTF8') where datname = '$db_name' AND encoding = pg_char_to_encoding('SQL_ASCII');" || true
266+
if [ ! -z "$DISCOURSE_DB_PASSWORD" ]; then
267+
echo "alter user $db_user with password '$DISCOURSE_DB_PASSWORD';" | su - postgres -c 'psql $db_name'
268+
fi
266269
267270
- file:
268271
path: /var/lib/postgresql/take-database-backup

0 commit comments

Comments
 (0)