Skip to content

fix: make non-essential env vars optional#71

Open
rasswanth-lyzr wants to merge 1 commit into
mainfrom
fix/cleanup-optional-env-vars
Open

fix: make non-essential env vars optional#71
rasswanth-lyzr wants to merge 1 commit into
mainfrom
fix/cleanup-optional-env-vars

Conversation

@rasswanth-lyzr

Copy link
Copy Markdown
Collaborator

Summary

  • Converts 7 env vars from hard-required (crash on startup if missing) to optional (os.getenv returning None) in config.py
  • Adds call-site guards so each feature degrades gracefully when unconfigured:
    • Logfire (WRITE_TOKEN / READ_TOKEN): analytics routes return empty lists; logfire instrumentation is skipped
    • Stripe (SECRET_KEY / WEBHOOK_SIGNING_SECRET): stripe init is skipped; webhook endpoint returns 503
    • Anthropic (ANTHROPIC_API_KEY): frontend QA agent returns None early
    • Vector DB (VECTOR_DB_FULL_URL): docs search endpoint returns 503
    • ALB DNS (APPLICATION_LOAD_BALANCER_DNS): ProxyHeadersMiddleware is skipped entirely
  • Confirms SEEDING_LAMBDA_URL and SKIP_AUTO_SEED are unused across main, prod, enterprise/prod, and onprem/dev — safe to remove from deployment configs

Test plan

  • Server starts without the 7 env vars set
  • Analytics endpoints (/v1/analytics/*) return [] when LOGFIRE_READ_TOKEN is absent
  • POST /v1/billing/webhook returns 503 when STRIPE_WEBHOOK_SIGNING_SECRET is absent
  • GET /v1/docs returns 503 when VECTOR_DB_FULL_URL is absent
  • All normal functionality unaffected when vars are present

🤖 Generated with Claude Code

Converts 7 placeholder-valued env vars from hard-required to optional
so the server starts cleanly without them:
- SERVER_LOGFIRE_WRITE_TOKEN / SERVER_LOGFIRE_READ_TOKEN (observability)
- SERVER_STRIPE_SECRET_KEY / SERVER_STRIPE_WEBHOOK_SIGNING_SECRET (billing)
- SERVER_ANTHROPIC_API_KEY (frontend QA agent)
- SERVER_VECTOR_DB_FULL_URL (docs search)
- SERVER_APPLICATION_LOAD_BALANCER_DNS (proxy headers middleware)

Each call site now guards with an early return (empty list / None / 503)
when the corresponding config value is None. SEEDING_LAMBDA_URL,
SKIP_AUTO_SEED, DB_SECRET_NAME, and AWS_REGION_NAME are confirmed unused
on main and can be dropped from deployment env configs.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant