- Remove all hardcoded credentials and config from Python source code:
- db.py: DB host/user/password/name/port → env vars with connection retry support
- cm_bot_hal.py: prefix, agent_id, agent_password, security_pin → env vars
- cm_bot.py: base_url → env var, fix register_user return values
- cm_web_view.py: hardcoded '13c' prefix → configurable CM_PREFIX_PATTERN
- cm_telegram.py: hardcoded 'Sky533535' pin → env var CM_SECURITY_PIN
- Parameterize docker-compose.yml for multi-deployment on same host:
- Container names use ${CM_DEPLOY_NAME} prefix (e.g. rex-cm-*, siong-cm-*)
- Network name uses ${CM_DEPLOY_NAME}-network
- Web view port configurable via ${CM_WEB_HOST_PORT}
- All service config passed as env vars (not baked into image)
- Add per-deployment env configs:
- envs/rex/.env (port 8001, prefix 13c, DB rex_cm)
- envs/siong/.env (port 8005, prefix 13sa, DB siong_cm)
- .env.example as template for new deployments
- Remove .env from .gitignore (local server, safe to commit)
- Improve telegram bot reliability:
- Add retry logic for polling with exponential backoff
- Add error handlers for Conflict, RetryAfter, NetworkError, TimedOut
- Add /9 command to show chat ID
- Add telegram_notifier.py for alert notifications
- Fix error handling in /2 and /3 command handlers
- Fix db.py cursor cleanup (close cursor before connection in finally blocks)
- Fix docker-compose.override.yml environment syntax (list → mapping)
- Update README with multi-deployment instructions
- Add AGENTS.md
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
29 lines
628 B
Bash
29 lines
628 B
Bash
# === Deployment Identity ===
|
|
CM_DEPLOY_NAME=siong-cm
|
|
CM_WEB_HOST_PORT=8005
|
|
|
|
# === Docker Registry ===
|
|
CM_IMAGE_PREFIX=gitea.04080616.xyz/yiekheng
|
|
DOCKER_IMAGE_TAG=latest
|
|
|
|
# === Telegram ===
|
|
TELEGRAM_BOT_TOKEN=7028479329:AAH_UTPoYcaB0iZMXJjO7pKYxyub8ZSXn2E
|
|
TELEGRAM_ALERT_CHAT_ID=818380985
|
|
|
|
# === Database ===
|
|
DB_HOST=192.168.0.210
|
|
DB_USER=siong_cm
|
|
DB_PASSWORD=hengserver
|
|
DB_NAME=siong_cm
|
|
DB_PORT=3306
|
|
DB_CONNECTION_TIMEOUT=8
|
|
DB_CONNECT_RETRIES=5
|
|
DB_CONNECT_RETRY_DELAY=2
|
|
|
|
# === Bot Config ===
|
|
CM_PREFIX_PATTERN=13sa
|
|
CM_AGENT_ID=cm13a39
|
|
CM_AGENT_PASSWORD=Wenwen12345
|
|
CM_SECURITY_PIN=Wenwen12345
|
|
CM_BOT_BASE_URL=https://cm99.net
|