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:
+14
-11
@@ -1,20 +1,23 @@
|
|||||||
# Local / host Prisma
|
# این فایل فقط روی سرور/لوکال میماند و داخل گیت commit نمیشود.
|
||||||
DATABASE_URL="postgresql://fabric:fabric123@localhost:5432/fabric_trade?schema=public"
|
# ایمیج Docker سکرت ندارد؛ همه تنظیمات از اینجا خوانده میشود.
|
||||||
|
|
||||||
# Docker Compose
|
|
||||||
POSTGRES_USER=fabric
|
POSTGRES_USER=fabric
|
||||||
POSTGRES_PASSWORD=fabric123
|
POSTGRES_PASSWORD=fabric123
|
||||||
POSTGRES_DB=fabric_trade
|
POSTGRES_DB=fabric_trade
|
||||||
POSTGRES_PORT=5432
|
POSTGRES_PORT=5432
|
||||||
|
|
||||||
|
# برای ابزارهای روی خود سرور (خارج از Docker)
|
||||||
|
DATABASE_URL=postgresql://fabric:fabric123@localhost:5432/fabric_trade?schema=public
|
||||||
|
|
||||||
API_PORT=3000
|
API_PORT=3000
|
||||||
|
PORT=3000
|
||||||
|
API_IMAGE=fabric-trade-api:latest
|
||||||
RUN_SEED=false
|
RUN_SEED=false
|
||||||
# میرور npm کامل (سازگار با package-lock)
|
|
||||||
# توجه: mirror.iranserver.com/npm ناقص است و 404 میدهد
|
JWT_SECRET=change-me-to-a-long-random-string
|
||||||
|
JWT_EXPIRES_IN=7d
|
||||||
|
MOCK_OTP_CODE=123456
|
||||||
|
OTP_TTL_MINUTES=5
|
||||||
|
|
||||||
NPM_REGISTRY=https://registry.npmmirror.com
|
NPM_REGISTRY=https://registry.npmmirror.com
|
||||||
COMPOSE_BAKE=false
|
COMPOSE_BAKE=false
|
||||||
|
|
||||||
JWT_SECRET="fabric-trade-dev-secret-change-me"
|
|
||||||
JWT_EXPIRES_IN="7d"
|
|
||||||
PORT=3000
|
|
||||||
MOCK_OTP_CODE="123456"
|
|
||||||
OTP_TTL_MINUTES=5
|
|
||||||
|
|||||||
@@ -3,6 +3,8 @@ services:
|
|||||||
image: postgres:16-alpine
|
image: postgres:16-alpine
|
||||||
container_name: fabric_trade_db
|
container_name: fabric_trade_db
|
||||||
restart: unless-stopped
|
restart: unless-stopped
|
||||||
|
env_file:
|
||||||
|
- .env
|
||||||
environment:
|
environment:
|
||||||
POSTGRES_USER: ${POSTGRES_USER:-fabric}
|
POSTGRES_USER: ${POSTGRES_USER:-fabric}
|
||||||
POSTGRES_PASSWORD: ${POSTGRES_PASSWORD:-fabric123}
|
POSTGRES_PASSWORD: ${POSTGRES_PASSWORD:-fabric123}
|
||||||
@@ -18,21 +20,19 @@ services:
|
|||||||
retries: 10
|
retries: 10
|
||||||
|
|
||||||
api:
|
api:
|
||||||
# ایمیج از قبل روی سرور load شده (بدون build)
|
|
||||||
image: ${API_IMAGE:-fabric-trade-api:latest}
|
image: ${API_IMAGE:-fabric-trade-api:latest}
|
||||||
container_name: fabric_trade_api
|
container_name: fabric_trade_api
|
||||||
restart: unless-stopped
|
restart: unless-stopped
|
||||||
depends_on:
|
depends_on:
|
||||||
postgres:
|
postgres:
|
||||||
condition: service_healthy
|
condition: service_healthy
|
||||||
|
# سکرتها و تنظیمات از فایل .env روی خود سرور
|
||||||
|
env_file:
|
||||||
|
- .env
|
||||||
environment:
|
environment:
|
||||||
|
# داخل شبکه Docker هاست دیتابیس همیشه "postgres" است
|
||||||
DATABASE_URL: postgresql://${POSTGRES_USER:-fabric}:${POSTGRES_PASSWORD:-fabric123}@postgres:5432/${POSTGRES_DB:-fabric_trade}?schema=public
|
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}
|
PORT: ${PORT:-3000}
|
||||||
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}
|
|
||||||
ports:
|
ports:
|
||||||
- '127.0.0.1:${API_PORT:-3000}:3000'
|
- '127.0.0.1:${API_PORT:-3000}:3000'
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user