# ============================================================================= # OpenCodeReview — Environment Variables # ============================================================================= # # Copy this file to .env and fill in your values: # cp .env.example .env # # Docker Compose automatically loads from .env. For direct CLI usage, # export vars manually or use a tool like direnv / dotenv. # # Required vars are marked [REQUIRED]; all others are optional. # ============================================================================= # ─── AI Providers ──────────────────────────────────────────────────────────── # Optional Cloudflare Workers AI default. Set both account ID and API token. # CLOUDFLARE_ACCOUNT_ID=your_account_id # CLOUDFLARE_API_TOKEN=your_workers_ai_token # CLOUDFLARE_GATEWAY_ID=default # optional Cloudflare AI Gateway route # CLOUDFLARE_GATEWAY_TOKEN=your_ai_gateway_run_token # optional separate gateway auth token # CLOUDFLARE_MODEL=@cf/zai-org/glm-4.7-flash # CLOUDFLARE_DAILY_REQUEST_LIMIT=50 # [REQUIRED - at least one] LLM API key for the AI reviewers. # # Primary: Google Gemini API (generous free tier ~1 500 req/day). # Get one at: https://aistudio.google.com/apikey GEMINI_API_KEY=AIza_your_key_here # # Fallback: Groq API (used when Gemini key is not set). # Get one at: https://console.groq.com GROQ_API_KEY=gsk_your_key_here # ─── GitHub API ────────────────────────────────────────────────────────────── # [REQUIRED] GitHub personal access token with "repo" scope. # Used for: # - Fetching PR diffs and changed files # - Posting review comments # - Fetching evaluation data (eval_data/fetcher.py) # - Building vector-store indexes from repo file trees # # Create one at: https://github.com/settings/tokens GITHUB_TOKEN=ghp_your_token_here # ─── GitHub OAuth (Device Flow) ────────────────────────────────────────────── # [Optional] OAuth App client ID for interactive login via: # opencodereview auth login # # Register a new OAuth App at https://github.com/settings/developers # and enable Device Flow in the app settings. # GITHUB_OAUTH_CLIENT_ID=Iv23li_your_client_id_here # ─── Observability: LangSmith (Tracing) ────────────────────────────────────── # [Optional] LangSmith enables full run tracing via LangChain/LangGraph. # Get a key at: https://smith.langchain.com # LANGCHAIN_API_KEY=lsv2_your_key_here # # [Optional] LangSmith project name (default: "opencodereview") # LANGCHAIN_PROJECT=opencodereview # ─── Observability: Langfuse (Tracing) ────────────────────────────────────── # [Optional] Langfuse provides an alternative tracing backend. # Both public and secret keys are required to enable it. # Sign up at: https://cloud.langfuse.com # LANGFUSE_PUBLIC_KEY=pk_your_public_key_here # LANGFUSE_SECRET_KEY=sk_your_secret_key_here # # [Optional] Langfuse host URL (default: https://cloud.langfuse.com) # For self-hosted: http://localhost:3000 # LANGFUSE_HOST=https://cloud.langfuse.com # ─── Fallback AI Provider ──────────────────────────────────────────────────── # [Optional] Anthropic API key (used as fallback via config.py/Settings). # OPENCODEREVIEW_ANTHROPIC_KEY=sk-ant_your_key_here # ─── Alerting Webhooks ─────────────────────────────────────────────────────── # [Optional] Webhook URLs for the smoke-test alerting monitor # (scripts/alert.py). Set at least one to receive notifications when the # smoke-test score deviates significantly from baseline. # # Create a Discord webhook at: Server Settings → Integrations → Webhooks # DISCORD_WEBHOOK=https://discord.com/api/webhooks/your_webhook_id # # Create a Slack webhook at: https://api.slack.com/messaging/webhooks # SLACK_WEBHOOK=https://hooks.slack.com/services/your_webhook # ─── Hugging Face Spaces (Deployment) ─────────────────────────────────────── # [Optional] Used by .github/workflows/deploy-hf.yml to sync to HF Spaces. # Get a token at: https://huggingface.co/settings/tokens # HF_TOKEN=hf_your_token_here # ─── Server ────────────────────────────────────────────────────────────────── # [Optional] Port for the Gradio web UI (default: 7860). # HF Spaces sets this automatically. # PORT=7860 # Durable job/checkpoint path. Point this at a mounted persistent volume in a # hosted deployment; the default local file is ephemeral on most containers. # OPENCODEREVIEW_DB_PATH=/data/opencodereview/checkpoints.db # Optional Supabase Postgres URL for the durable review-jobs store. # SUPABASE_DB_URL=postgresql://postgres:@db..supabase.co:5432/postgres # ─── API security ─────────────────────────────────────────────────────────── # [Recommended for any public deployment] Require X-API-Key on React/API # requests. Set both values in the deployment secret configuration. # OCR_REQUIRE_AUTH=true # OCR_API_KEY=replace_with_a_long_random_value # # [Recommended] Comma-separated browser origins allowed to call the API. # OCR_ALLOWED_ORIGINS=https://your-frontend.example.com # Reviewer wall-clock budgets, including any response-format repair. # Fast mode reduces input/output size; it does not impose a hidden 45s cap. # OCR_REVIEWER_TIMEOUT_SECONDS=90 # OCR_FAST_REVIEWER_TIMEOUT_SECONDS=90