"""Uvicorn production configuration for horizontal scaling. Usage: uvicorn fusionagi.api.app:create_app --factory --config uvicorn_config.py Or with gunicorn (recommended for multi-process): gunicorn -c gunicorn.conf.py fusionagi.api.app:create_app Environment variables: FUSIONAGI_WORKERS: Number of worker processes (default: CPU count) FUSIONAGI_BIND: Host:port (default: 0.0.0.0:8000) FUSIONAGI_DB_BACKEND: memory|sqlite|postgres (default: memory) FUSIONAGI_REDIS_URL: Redis URL for shared cache (required for multi-worker) FUSIONAGI_POSTGRES_DSN: Postgres DSN for shared persistence (required for multi-worker) """ import multiprocessing import os host = os.environ.get("FUSIONAGI_HOST", "0.0.0.0") port = int(os.environ.get("FUSIONAGI_PORT", "8000")) workers = int(os.environ.get("FUSIONAGI_WORKERS", multiprocessing.cpu_count())) log_level = os.environ.get("FUSIONAGI_LOG_LEVEL", "info").lower() access_log = True reload = os.environ.get("FUSIONAGI_RELOAD", "false").lower() in ("true", "1") timeout_keep_alive = 5 limit_concurrency = int(os.environ.get("FUSIONAGI_CONCURRENCY", "100"))