Skip to content

Commit

Permalink
chore: refine pgsql-multudb docker compose
Browse files Browse the repository at this point in the history
  • Loading branch information
riipandi committed Sep 5, 2024
1 parent 01321f8 commit 669194e
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ services:
environment:
POSTGRES_USER: postgres
POSTGRES_PASSWORD: securedb
POSTGRES_MULTIPLE_DATABASES: remixdb,extradb
POSTGRES_DATABASES: remixdb,extradb
command: ['postgres', '-c', 'wal_level=logical']
healthcheck:
test: ['CMD-SHELL', 'pg_isready -U postgres -d remixdb']
Expand Down
6 changes: 3 additions & 3 deletions scripts/pgsql-multidb.sh
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,9 @@ function create_user_and_database() {
EOSQL
}

if [ -n "$POSTGRES_MULTIPLE_DATABASES" ]; then
echo "Multiple database creation requested: $POSTGRES_MULTIPLE_DATABASES"
for db in $(echo $POSTGRES_MULTIPLE_DATABASES | tr ',' ' '); do
if [ -n "$POSTGRES_DATABASES" ]; then
echo "Multiple database creation requested: $POSTGRES_DATABASES"
for db in $(echo $POSTGRES_DATABASES | tr ',' ' '); do
create_user_and_database $db
done
echo "Multiple databases created"
Expand Down

0 comments on commit 669194e

Please sign in to comment.