Selaa lähdekoodia

feat: interpolate name of user and database

Unless explicitely set, the database name is nevertheless derived from
the user by the image's entrypoint, but we can make this more obvious by
defining a interpolation here.
Christoph Schug 2 vuotta sitten
vanhempi
commit
911fcc61eb
1 muutettua tiedostoa jossa 2 lisäystä ja 3 poistoa
  1. 2 3
      docker-compose/postgres/docker-compose.yaml

+ 2 - 3
docker-compose/postgres/docker-compose.yaml

@@ -7,10 +7,9 @@ services:
     environment:
       - POSTGRES_INITDB_ARGS=${POSTGRES_INITDB_ARGS---data-checksums}
       - POSTGRES_HOST_AUTH_METHOD=${POSTGRES_HOST_AUTH_METHOD-}
-      - POSTGRES_USER=${POSTGRES_USER}
+      - POSTGRES_USER=${POSTGRES_USER:-postgres}
       - POSTGRES_PASSWORD_FILE=/run/secrets/postgres_password
-      # (Optional) when creating a new database
-      # - POSTGRES_DB=${POSTGRES_DB}
+      - POSTGRES_DB=${POSTGRES_DB:-$POSTGRES_USER}
       - TZ=${TZ:-UTC}
     ports:
       - 5432:5432