games_app/.env.example
2026-10-26 10:05:49 +02:00

151 lines
6.8 KiB
Plaintext

# =============================================================================
# Tloto — variables d'environnement (NE PAS committer le fichier .env réel)
#
# DÉVELOPPEMENT LOCAL avec Docker (stack identique au VPS, Postgres sur l'hôte) :
# • cp .env.docker.example .env.docker
# • npm run docker:local:up && npm run docker:local:migrate
# • http://localhost:9080
#
# DÉVELOPPEMENT LOCAL sans Docker :
# • backend/.env ← copier depuis backend/.env.example (localhost:5432, port 4000)
# • prediqo_web/.env ← copier depuis prediqo_web/.env.example (VITE → localhost:4000)
# • Pas besoin de .env à la racine pour coder au quotidien.
# • Lancer : cd backend && npm run dev | cd prediqo_web && npm run dev
#
# VPS (Docker Compose) :
# • .env à la RACINE uniquement (copier ce fichier → .env, valeurs production)
# • 1er déploiement : npm run phase-b:init (HTTP :9080)
# • ou HTTPS : npm run phase-b:init:https (après certificat DNS)
# • ensuite : npm run phase-b:up
# • après git pull + schema.sql : npm run db:migrate
# • Le .env du VPS reste sur le serveur — jamais écrasé par git pull.
# =============================================================================
# Docker Compose + Phase B — copy to .env in repo root (VPS)
# Migrations manuelles (base vide ou après changement de schéma) : npm run db:migrate
# Frontend: cd prediqo_web && npm run dev
# PostgreSQL (host — les conteneurs Docker utilisent host.docker.internal, PAS localhost)
POSTGRES_USER=postgres
POSTGRES_PASSWORD=your_postgres_password
POSTGRES_DB=games_platform_db
POSTGRES_PORT=5432
PGBOUNCER_PORT=6432
# URL pour Docker (backend dans les conteneurs) — obligatoire sur VPS :
DATABASE_URL=postgresql://postgres:your_postgres_password@host.docker.internal:5432/games_platform_db
# URL pour psql / outils sur l'hôte uniquement :
# DATABASE_URL=postgresql://postgres:your_postgres_password@localhost:5432/games_platform_db
DATABASE_PASSWORD=your_postgres_password
# 1 = run schema.sql on every backend start (slow). 0 = run npm run db:migrate on deploy only (recommended).
RUN_MIGRATE_ON_START=0
# Phase B ports
BACKEND_PORT=4000
WS_PORT=4001
# Redis is NOT published on the host (Docker network only). Optional debug map only:
# REDIS_PORT=6379
WORKER_ID=worker-1
# Required by docker-compose redis + REDIS_URL auth (hex/alphanumeric recommended)
REDIS_PASSWORD=change-me-to-a-long-random-hex-secret
# Backend secrets
JWT_SECRET=your-super-secret-jwt-key-min-32-chars
JWT_ACCESS_EXPIRY=15m
JWT_REFRESH_EXPIRY=7d
ENCRYPTION_KEY=0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef
# Optional during key rotation: previous key so decrypt() can read legacy ciphertext
ENCRYPTION_KEY_PREVIOUS=
# Comma-separated web origins allowed in production (e.g. https://app.prediqo.com)
CORS_ORIGINS=http://localhost:5173
# Optional Cloudflare Turnstile (captcha after failed logins)
TURNSTILE_SITE_KEY=
TURNSTILE_SECRET_KEY=
PLATFORM_MNEMONIC=word1 word2 ... word24
# Blockchain (testnet example for TRON; BSC mainnet for dual-chain USDT)
TRON_NODE_URL=https://api.shasta.trongrid.io
TRON_CONFIRMATIONS=3
USDT_TRC20_CONTRACT=
# BSC (USDT BEP20) — public Binance dataseed often rejects eth_getLogs (-32005 limit exceeded).
# Balances/receipts still work on dataseed; getLogs uses BSC_RPC_FALLBACKS automatically.
BSC_RPC_URL=https://bsc-dataseed.binance.org
BSC_RPC_FALLBACKS=https://rpc-bsc.48.club
BSC_CONFIRMATIONS=15
# Leave empty to use official USDT BEP20 from DB (0x55d3…7955)
USDT_BEP20_CONTRACT=
BSC_GETLOGS_BLOCK_RANGE=2000
# Unpaid HD catch-up lookback (~3s/block). 200000 ≈ 7 days — must cover deposits missed during RPC outages.
BSC_UNPAID_LOOKBACK_BLOCKS=200000
# Optional Etherscan API V2 key (BSC may require a paid chain plan). Not required if RPC fallbacks work.
# BSCSCAN_API_KEY=
# Optional Etherscan-compatible tokentx base URL (leave empty unless you have a working host)
# BSC_EXPLORER_API_URL=
POLYGON_RPC_URL=https://rpc-amoy.polygon.technology
POLYGON_CONFIRMATIONS=8
USDC_POLYGON_CONTRACT=
ALLOW_WITHDRAWALS=false
# Treasury sweeps (deposit HD → cold). Also wire these in docker-compose (recreate backend after change).
SWEEP_ENABLED=false
# true = auto HD→cold without Approvals (recommended only with SWEEP_COLD_ALLOWLIST set)
# SWEEP_AUTO_EXECUTE=false
# Optional raw max for auto path; above this still needs Approvals (BEP20: 18 decimals, e.g. 100 USDT = 100000000000000000000)
# SWEEP_AUTO_MAX_AMOUNT_RAW=
# Pin allowed cold destination(s); blocks sweeps if DB cold is changed to another address
# SWEEP_COLD_ALLOWLIST=0xYourColdAddress
# Min on-chain raw units to enqueue (TRC20: 1e6 = 1 USDT; BEP20 uses 18-dec chain amount so 1e6 is tiny)
SWEEP_MIN_AMOUNT_RAW=1000000
# SWEEP_BSC_GAS_TOPUP_WEI=1000000000000000
# SWEEP_TRON_GAS_TOPUP_SUN=15000000
# Optional USDT left on hot after Hot→Cold (raw units; default 0). BEP20 18 dec / TRC20 6 dec.
# HOT_USDT_MIN_RESERVE_RAW=0
RATE_LIMIT_MAX=2000
# Ports dédiés Tloto (n'utilise pas 80/443 du VPS)
PREDIQO_HTTP_PORT=9080
PREDIQO_HTTPS_PORT=9443
CERTBOT_EMAIL=your-email@example.com
CERTBOT_DOMAIN1=prediqo.redirectme.net
APP_PUBLIC_URL=http://prediqo.redirectme.net:9080
INITIAL_SETUP_TOKEN=your-random-setup-token-min-32-chars
# Emergency Super Admin 2FA reset (CLI / Docker only — not an HTTP API). Min 32 chars; distinct from JWT/setup tokens.
# Generate: node -e "console.log(require('crypto').randomBytes(48).toString('hex'))"
# Leave empty to disable break-glass until you need it.
BREAK_GLASS_TOKEN=
# Figées au build Docker (prediqo-web) — mode HTTP VPS :
VITE_API_BASE_URL=http://prediqo.redirectme.net:9080
VITE_WS_ENABLED=true
VITE_WS_URL=ws://prediqo.redirectme.net:9080/ws/v1/games/candle-predict
# Mode HTTPS VPS (décommenter après certificat) :
# APP_PUBLIC_URL=https://prediqo.redirectme.net:9443
# VITE_API_BASE_URL=https://prediqo.redirectme.net:9443
# VITE_WS_URL=wss://prediqo.redirectme.net:9443/ws/v1/games/candle-predict
# Phase B feature flags (used by Docker services)
# Compose injects redis://:${REDIS_PASSWORD}@redis:6379 into containers.
# Local backend outside Docker (only if you temporarily publish Redis):
# REDIS_URL=redis://:YOUR_REDIS_PASSWORD@localhost:6379
REDIS_ENABLED=true
REDIS_ROUND_CACHE=true
# BET_ASYNC=true enables async bet queue for WebSocket place_bet only.
# HTTP single bets are always synchronous (same as multi-candle).
BET_ASYNC=true
WS_ENABLED=true
WS_PATH=/ws/v1/games/candle-predict
# Observability & upload security (optional — see deploy/PRODUCTION_SENTRY_CLAMAV.md)
# SENTRY_DSN=https://...@sentry.io/...
# SENTRY_TRACES_SAMPLE_RATE=0.1
# SENTRY_RELEASE=prediqo@1.0.0
# VITE_SENTRY_DSN=https://...@sentry.io/...
# VITE_SENTRY_TRACES_SAMPLE_RATE=0.1
# CLAMAV_ENABLED=true
# CLAMAV_HOST=clamav
# CLAMAV_PORT=3310
# Optional: containerized PostgreSQL instead of host
# docker compose --profile docker-db up -d