Pārlūkot izejas kodu

Remove unnecessary values from docker compose. Make env file more parametrized. (#96)

Mirko Jeličić 4 nedēļas atpakaļ
vecāks
revīzija
b0c9b65a43
2 mainītis faili ar 8 papildinājumiem un 6 dzēšanām
  1. 6 1
      .env.example
  2. 2 5
      docker-compose.yml

+ 6 - 1
.env.example

@@ -1,6 +1,11 @@
 # Database Configuration
+POSTGRES_USER=my-user
+POSTGRES_PASSWORD=my-password
+POSTGRES_DB=workout-cool
+DB_HOST=localhost
+DB_PORT=5432
 # Format: postgresql://USER:PASSWORD@HOST:PORT/DATABASE
-DATABASE_URL=postgresql://username:password@localhost:5432/workout_cool
+DATABASE_URL=postgresql://${POSTGRES_USER}:${POSTGRES_PASSWORD}@${DB_HOST}:${DB_PORT}/${POSTGRES_DB}
 
 # Authentication
 # The URL where your application is running

+ 2 - 5
docker-compose.yml

@@ -3,17 +3,14 @@ services:
     image: postgres:15
     ports:
       - "${DB_PORT:-5432}:5432"
-    environment:
-      POSTGRES_USER: username
-      POSTGRES_PASSWORD: password
-      POSTGRES_DB: workout_cool
     volumes:
       - pgdata:/var/lib/postgresql/data
     healthcheck:
-      test: ["CMD-SHELL", "pg_isready -U username -d workout_cool"]
+      test: ["CMD-SHELL", "pg_isready -U ${POSTGRES_USER} -d ${POSTGRES_DB}"]
       interval: 5s
       timeout: 5s
       retries: 5
+    env_file: .env
 
   workout_cool:
     build: