Load runtime config from server .env via compose env_file

Keep secrets out of the image; only override DATABASE_URL host for the Docker network.

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
2026-08-05 21:29:21 +03:30
co-authored by Cursor
parent 1fdbae1791
commit 1b249e0b57
2 changed files with 21 additions and 18 deletions
+7 -7
View File
@@ -3,6 +3,8 @@ services:
image: postgres:16-alpine
container_name: fabric_trade_db
restart: unless-stopped
env_file:
- .env
environment:
POSTGRES_USER: ${POSTGRES_USER:-fabric}
POSTGRES_PASSWORD: ${POSTGRES_PASSWORD:-fabric123}
@@ -18,21 +20,19 @@ services:
retries: 10
api:
# ایمیج از قبل روی سرور load شده (بدون build)
image: ${API_IMAGE:-fabric-trade-api:latest}
container_name: fabric_trade_api
restart: unless-stopped
depends_on:
postgres:
condition: service_healthy
# سکرت‌ها و تنظیمات از فایل .env روی خود سرور
env_file:
- .env
environment:
# داخل شبکه Docker هاست دیتابیس همیشه "postgres" است
DATABASE_URL: postgresql://${POSTGRES_USER:-fabric}:${POSTGRES_PASSWORD:-fabric123}@postgres:5432/${POSTGRES_DB:-fabric_trade}?schema=public
JWT_SECRET: ${JWT_SECRET:-fabric-trade-dev-secret-change-me}
JWT_EXPIRES_IN: ${JWT_EXPIRES_IN:-7d}
PORT: 3000
MOCK_OTP_CODE: ${MOCK_OTP_CODE:-123456}
OTP_TTL_MINUTES: ${OTP_TTL_MINUTES:-5}
RUN_SEED: ${RUN_SEED:-false}
PORT: ${PORT:-3000}
ports:
- '127.0.0.1:${API_PORT:-3000}:3000'