Prechádzať zdrojové kódy

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 rokov pred
rodič
commit
911fcc61eb

+ 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