fix(docker): align database config between docker-compose and .env
- Move POSTGRES_USER, POSTGRES_PASSWORD, POSTGRES_DB to .env - Update docker-compose.yml to reference env vars instead of hardcoding - Fix db healthcheck to use correct credentials from .env - Update .env.example with matching placeholder values - Update DATABASE_URL to use variable interpolation
This commit is contained in:
+3
-3
@@ -7,9 +7,9 @@ FLASK_DEBUG=1
|
||||
# ═════════════════════════════════════════════════════════════════════════════
|
||||
COMPOSE_PROJECT_NAME=authy2
|
||||
FLASK_ENV=production
|
||||
POSTGRES_USER=authy2
|
||||
POSTGRES_PASSWORD=changeme-in-production
|
||||
POSTGRES_DB=authy2
|
||||
POSTGRES_USER=appuser
|
||||
POSTGRES_PASSWORD=change-me-in-production
|
||||
POSTGRES_DB=secuird
|
||||
DATABASE_URL=postgresql://${POSTGRES_USER}:${POSTGRES_PASSWORD}@db:5432/${POSTGRES_DB}
|
||||
SQLALCHEMY_DATABASE_URI=${DATABASE_URL}
|
||||
REDIS_URL=redis://redis:6379/0
|
||||
|
||||
+4
-12
@@ -7,14 +7,6 @@ services:
|
||||
dockerfile: Dockerfile
|
||||
env_file:
|
||||
- .env
|
||||
environment:
|
||||
- FLASK_ENV=production
|
||||
- CORS_ORIGINS=http://192.168.50.124:8080,http://localhost:8080,http://localhost:5173
|
||||
- DATABASE_URL=postgresql://${POSTGRES_USER:-gatehouse}:${POSTGRES_PASSWORD:-gatehouse}@db:5432/${POSTGRES_DB:-gatehouse}
|
||||
- SQLALCHEMY_DATABASE_URI=postgresql://${POSTGRES_USER:-gatehouse}:${POSTGRES_PASSWORD:-gatehouse}@db:5432/${POSTGRES_DB:-gatehouse}
|
||||
- REDIS_URL=redis://redis:6379/0
|
||||
- SESSION_REDIS_URL=redis://redis:6379/0
|
||||
- RATELIMIT_STORAGE_URL=redis://redis:6379/1
|
||||
ports:
|
||||
- "${API_PORT:-5000}:5000"
|
||||
depends_on:
|
||||
@@ -35,16 +27,16 @@ services:
|
||||
db:
|
||||
image: postgres:16-alpine
|
||||
environment:
|
||||
- POSTGRES_USER=${POSTGRES_USER:-gatehouse}
|
||||
- POSTGRES_PASSWORD=${POSTGRES_PASSWORD:-gatehouse}
|
||||
- POSTGRES_DB=${POSTGRES_DB:-gatehouse}
|
||||
- POSTGRES_USER=${POSTGRES_USER}
|
||||
- POSTGRES_PASSWORD=${POSTGRES_PASSWORD}
|
||||
- POSTGRES_DB=${POSTGRES_DB}
|
||||
volumes:
|
||||
- postgres_data:/var/lib/postgresql/data
|
||||
networks:
|
||||
- authy2-network
|
||||
restart: unless-stopped
|
||||
healthcheck:
|
||||
test: ["CMD-SHELL", "pg_isready -U ${POSTGRES_USER:-gatehouse} -d ${POSTGRES_DB:-gatehouse}"]
|
||||
test: ["CMD-SHELL", "pg_isready -U ${POSTGRES_USER} -d ${POSTGRES_DB}"]
|
||||
interval: 10s
|
||||
timeout: 5s
|
||||
retries: 5
|
||||
|
||||
Reference in New Issue
Block a user