# Environment Configuration for ABSA Insights Application # Copy this file to .env and fill in your values # ===== REQUIRED ENVIRONMENT VARIABLES ===== # MongoDB Configuration # MongoDB connection string for telemetry event store # Example: mongodb+srv://username:password@cluster.mongodb.net/database MONGO_URI= # Redis Configuration # Redis host (default: localhost) REDIS_HOST=localhost # Redis port (default: 6379) REDIS_PORT=6379 # Redis password (leave empty if no password) REDIS_PASSWORD= # Admin Token # Static token for admin-only analytics endpoints # Generate a secure random token (e.g., using: openssl rand -hex 32) ADMIN_TOKEN= # IPinfo Token # API token for IP geolocation lookups # Get your token from: https://ipinfo.io/signup IPINFO_TOKEN= # ===== OPTIONAL ENVIRONMENT VARIABLES ===== # HuggingFace Token # Required for translation API (if using HF Inference API) HF_TOKEN= # Worker Configuration # Maximum number of worker threads for processing MAX_WORKERS=2 # ===== USAGE ===== # 1. Copy this file: # cp .env.example .env # 2. Fill in your credentials in .env # 3. Load environment variables: # - Linux/Mac: source .env (or use python-dotenv) # - Windows: Set environment variables in system settings # - Docker: Pass via docker-compose.yml or --env-file # 4. Start the application: # python ABSA/api_server.py # ===== SECURITY NOTES ===== # - NEVER commit .env to version control # - Add .env to .gitignore # - Use strong, random tokens for ADMIN_TOKEN # - Rotate credentials regularly # - Use environment-specific .env files for dev/staging/prod # ===== SERVICE CONFIGURATION DETAILS ===== # MongoDB: # - Used for append-only telemetry event logging # - Events: SESSION_METADATA, DASHBOARD_VIEW, ANALYSIS_REQUEST, # TASK_QUEUED, TASK_COMPLETED, RATE_LIMIT_HIT # - Retention: Optional TTL index (e.g., 30 days) # Redis: # - Rate limiting (2 requests per user per minute) # - Task queue for async ABSA processing # - IP lookup gating (once per device per 5 minutes) # IPinfo: # - Free tier: 50,000 requests/month # - Used only once per device per 5 minutes (Redis gated) # Admin Endpoints: # - /admin/metrics/summary # - /admin/metrics/events # - /admin/metrics/funnel # - /admin/metrics/rate-limits # - Requires: Authorization: Bearer