Enhance Docker support and configuration

- Updated .env.example to recommend using docker.env and secrets for sensitive data.
- Modified .gitignore to include docker.env and secrets directory.
- Adjusted docker-compose.yml to utilize environment files and updated port mappings.
- Implemented read_env_or_file utility for better environment variable management.
- Refactored portfolio and trades routers to use the new utility for fetching environment variables.
- Added integration and phase 2 test updates for new environment variable handling.
- Created new documentation for Docker operations and secret management.
- Added placeholder files for Docker secrets and configuration.
This commit is contained in:
coddard
2026-05-19 01:49:11 +03:00
parent 0096c8819b
commit eabc96371b
17 changed files with 404 additions and 44 deletions
+5 -3
View File
@@ -1,3 +1,4 @@
# For Docker Compose, prefer docker.env.example + ./secrets instead of this file.
# ─────────────────────────────────────────────────────────────────────────────
# IB Gateway (gnzsnz/ib-gateway:stable)
# ─────────────────────────────────────────────────────────────────────────────
@@ -7,17 +8,18 @@ TRADING_MODE=paper # paper | live
VNC_SERVER_PASSWORD=your_vnc_password
TWOFA_TIMEOUT_ACTION=restart # restart | exit
AUTO_RESTART_TIME=11:59 PM
RELOGIN_AFTER_2FA_TIMEOUT=yes
RELOGIN_AFTER_TWOFA_TIMEOUT=yes
EXISTING_SESSION_DETECTED_ACTION=primaryoverride # primary | primaryoverride | secondary
TIME_ZONE=Europe/Istanbul # e.g. America/New_York, Europe/London
# ─────────────────────────────────────────────────────────────────────────────
# FastAPI Application
# ─────────────────────────────────────────────────────────────────────────────
IBKR_HOST=ib-gateway # Docker service name; use 127.0.0.1 for local
IBKR_PORT=4002 # paper=4002, live=4001
IBKR_PORT=4002 # local paper=4002, local live=4001; docker service uses 4004/4003
IBKR_CLIENT_ID=1
WEBHOOK_SECRET=change_this_to_a_strong_random_secret # openssl rand -hex 32
DB_PATH=/app/trades.db
DB_PATH=/app/data/trades.db
# ─────────────────────────────────────────────────────────────────────────────
# Risk Management