Configurazione
File .env
Il file backend/.env contiene tutte le configurazioni del sistema.
Configurazione Base
bash
# Application
APP_NAME="BetIntel"
DEBUG=false
ENVIRONMENT=production
# Database
POSTGRES_HOST=postgres
POSTGRES_PORT=5432
POSTGRES_USER=postgres
POSTGRES_PASSWORD=your_secure_password
POSTGRES_DB=soccer_predictions
# Redis
REDIS_HOST=redis
REDIS_PORT=6379API Keys (Obbligatorie)
bash
# Football-Data.org (10 req/min free tier)
FOOTBALL_DATA_API_KEY=your_key_here
# The-Odds-API (500 req/month free tier)
THE_ODDS_API_KEY=your_key_here
# API-Football v3 (100 req/day free tier)
API_FOOTBALL_KEY=your_key_here
# RapidAPI (per odds avanzate)
RAPID_API_KEY=your_key_here
# OpenWeatherMap (opzionale)
OPENWEATHER_API_KEY=your_key_hereTelegram Bot
bash
# Bot token da @BotFather
TELEGRAM_BOT_TOKEN=your_bot_token
# Chat ID del canale/gruppo
TELEGRAM_CHAT_ID=-100xxxxxxxxxx
# Abilita notifiche
TELEGRAM_ENABLED=true
TELEGRAM_MIN_CONFIDENCE=65.0
TELEGRAM_DAILY_SEND_TIME=09:00Machine Learning
bash
# Path modelli
ML_MODELS_PATH=./ml_models
# Soglie predizioni
PREDICTION_CONFIDENCE_THRESHOLD=60
VALUE_BET_THRESHOLD=0.10
MAX_ODDS_FOR_VALUE=5.0
# Bankroll Management
INITIAL_BANKROLL=100.0
MAX_STAKE_PERCENTAGE=0.05
KELLY_FRACTION=0.25Background Jobs
bash
# Cron expressions
JOB_COLLECT_FIXTURES_CRON=0 */6 * * * # Ogni 6 ore
JOB_UPDATE_RESULTS_CRON=*/15 * * * * # Ogni 15 min
JOB_GENERATE_PREDICTIONS_CRON=0 8,20 * * * # Alle 8 e 20
JOB_TRACK_ODDS_CRON=0 */3 * * * # Ogni 3 oreVariabili di Environment per Produzione
Sicurezza
In produzione, usa sempre password sicure e non committare mai il file .env
bash
# Production settings
DEBUG=false
ENVIRONMENT=production
API_DOCS_ENABLED=false # Disabilita Swagger in prod
# Database con SSL
DATABASE_URL=postgresql://user:pass@host:5432/db?sslmode=require
# Rate limiting
RATE_LIMIT_FOOTBALL_DATA=10
RATE_LIMIT_RAPID_API=100Cache TTL
bash
# Tempo di cache (secondi)
CACHE_TTL_MATCHES_LIST=300 # 5 minuti
CACHE_TTL_MATCH_DETAIL=600 # 10 minuti
CACHE_TTL_PREDICTIONS=1800 # 30 minuti
CACHE_TTL_ODDS=180 # 3 minutiBookmaker Filtering
bash
# Mostra solo bookmaker italiani autorizzati ADM
FILTER_ITALIAN_BOOKMAKERS=trueValidazione Configurazione
bash
# Verifica configurazione
docker compose exec backend python -c "from app.core.config import settings; print(settings)"Prossimo Passo
Setup API - Come ottenere le API key