update .env.example and docker config

This commit is contained in:
2025-06-27 20:52:16 +01:00
parent 86572f06e9
commit e28da5def2
2 changed files with 13 additions and 7 deletions

View File

@@ -1,3 +1,9 @@
DATABASE_URL=postgresql+asyncpg://codetutor:codetutor@localhost:5432/codetutor # Database connection - REQUIRED
# Format: postgresql+asyncpg://USER:PASSWORD@HOST:PORT/DATABASE
DATABASE_URL=postgresql+asyncpg://user:password@localhost:5432/codetutor
# Debug mode (optional, default: false)
DEBUG=false DEBUG=false
# CORS allowed origins (optional, default: ["http://localhost:3000"])
CORS_ORIGINS=["http://localhost:3000"] CORS_ORIGINS=["http://localhost:3000"]

View File

@@ -3,15 +3,15 @@ services:
image: postgres:16-alpine image: postgres:16-alpine
container_name: codetutor-db container_name: codetutor-db
environment: environment:
POSTGRES_USER: codetutor POSTGRES_USER: ${POSTGRES_USER:-codetutor}
POSTGRES_PASSWORD: codetutor POSTGRES_PASSWORD: ${POSTGRES_PASSWORD:?POSTGRES_PASSWORD is required}
POSTGRES_DB: codetutor POSTGRES_DB: ${POSTGRES_DB:-codetutor}
ports: ports:
- "5432:5432" - "127.0.0.1:5432:5432"
volumes: volumes:
- codetutor-db-data:/var/lib/postgresql/data - codetutor-db-data:/var/lib/postgresql/data
healthcheck: healthcheck:
test: ["CMD-SHELL", "pg_isready -U codetutor"] test: ["CMD-SHELL", "pg_isready -U ${POSTGRES_USER:-codetutor}"]
interval: 5s interval: 5s
timeout: 5s timeout: 5s
retries: 5 retries: 5
@@ -22,7 +22,7 @@ services:
dockerfile: Dockerfile dockerfile: Dockerfile
container_name: codetutor-backend container_name: codetutor-backend
environment: environment:
DATABASE_URL: postgresql+asyncpg://codetutor:codetutor@db:5432/codetutor DATABASE_URL: postgresql+asyncpg://${POSTGRES_USER:-codetutor}:${POSTGRES_PASSWORD}@db:5432/${POSTGRES_DB:-codetutor}
CORS_ORIGINS: '["http://localhost:3000"]' CORS_ORIGINS: '["http://localhost:3000"]'
ports: ports:
- "8000:8000" - "8000:8000"