Use env vars for ports, add .env.TEST

- WIZARD_PORT, MYSQL_PORT, BACKEND_PORT, FRONTEND_PORT env vars
- .env.TEST with default values (8080, 3306, 8000, 3000)
- Scripts load .env.TEST automatically
- LISTEN_ADDR uses env vars
- Ports bound to 127.0.0.1 for security
This commit is contained in:
Zhi
2026-03-14 08:20:55 +00:00
parent 392e050caa
commit 03067ca3a8
5 changed files with 60 additions and 22 deletions

View File

@@ -30,11 +30,11 @@ services:
- wizard_config:/config
environment:
CONFIG_DIR: /config
LISTEN_ADDR: "0.0.0.0:8080"
LISTEN_ADDR: "0.0.0.0:${WIZARD_PORT:-8080}"
MAX_BACKUPS: "5"
CORS_ORIGINS: http://frontend:3000
CORS_ORIGINS: http://frontend:${FRONTEND_PORT:-3000}
ports:
- "18080:8080"
- "127.0.0.1:${WIZARD_PORT:-8080}:${WIZARD_PORT:-8080}"
networks:
- test-network
@@ -52,7 +52,7 @@ services:
CONFIG_FILE: harborforge.json
SECRET_KEY: ${SECRET_KEY:-change_me_in_production}
LOG_LEVEL: ${LOG_LEVEL:-INFO}
DATABASE_URL: mysql+pymysql://harborforge:harborforge_pass@mysql:3306/harborforge
DATABASE_URL: mysql+pymysql://harborforge:harborforge_pass@mysql:${MYSQL_PORT:-3306}/harborforge
networks:
- test-network
@@ -61,13 +61,13 @@ services:
context: ../HarborForge.Frontend
dockerfile: Dockerfile
args:
VITE_WIZARD_PORT: 8080
VITE_WIZARD_PORT: ${WIZARD_PORT:-8080}
VITE_WIZARD_HOST: wizard
image: harborforge-test-frontend:dev
container_name: harborforge-test-frontend
restart: "no"
environment:
VITE_API_BASE_URL: http://backend:8000
VITE_API_BASE_URL: http://backend:${BACKEND_PORT:-8000}
networks:
- test-network
@@ -79,10 +79,10 @@ services:
container_name: harborforge-test-runner
restart: "no"
environment:
BASE_URL: http://frontend:3000
WEB_SERVER_URL: http://frontend:3000
WIZARD_URL: http://wizard:8080/wizard
WIZARD_API_URL: http://wizard:8080
BASE_URL: http://frontend:${FRONTEND_PORT:-3000}
WEB_SERVER_URL: http://frontend:${FRONTEND_PORT:-3000}
WIZARD_URL: http://wizard:${WIZARD_PORT:-8080}/wizard
WIZARD_API_URL: http://wizard:${WIZARD_PORT:-8080}
CHROME_DEBUGGING_PORT: 9222
networks:
- test-network