Add environment variable validation on application startup #54

Closed
opened 2026-04-08 15:16:30 -04:00 by pook · 4 comments
Owner

ComplianceBot has no startup validation — missing or malformed env vars cause cryptic runtime errors instead of clear startup failures.

Implement:

  1. Create a startup validation module that runs before the server starts listening.
  2. Validate required vars exist: DATABASE_URL, OPENAI_API_KEY (or ANTHROPIC_API_KEY), STRIPE_SECRET_KEY, STRIPE_WEBHOOK_SECRET.
  3. Validate format where applicable: DATABASE_URL must be a valid postgres:// or sqlite:// URI, API keys must match expected prefix patterns (sk-, sk_live_).
  4. If any validation fails, log a clear error message listing ALL missing/invalid vars (not just the first one) and exit with code 1.
  5. In development, warn (don't fail) for optional vars like STRIPE_WEBHOOK_SECRET.

Acceptance criteria:

  • Server refuses to start if required vars are missing.
  • Error message lists all problems at once.
  • Format validation catches obviously wrong values.
  • Development mode is more permissive for optional payment vars.

Generated by CEO Planner (priority: 3)

ComplianceBot has no startup validation — missing or malformed env vars cause cryptic runtime errors instead of clear startup failures. Implement: 1. Create a startup validation module that runs before the server starts listening. 2. Validate required vars exist: DATABASE_URL, OPENAI_API_KEY (or ANTHROPIC_API_KEY), STRIPE_SECRET_KEY, STRIPE_WEBHOOK_SECRET. 3. Validate format where applicable: DATABASE_URL must be a valid postgres:// or sqlite:// URI, API keys must match expected prefix patterns (sk-*, sk_live_*). 4. If any validation fails, log a clear error message listing ALL missing/invalid vars (not just the first one) and exit with code 1. 5. In development, warn (don't fail) for optional vars like STRIPE_WEBHOOK_SECRET. Acceptance criteria: - Server refuses to start if required vars are missing. - Error message lists all problems at once. - Format validation catches obviously wrong values. - Development mode is more permissive for optional payment vars. --- *Generated by CEO Planner (priority: 3)*
Author
Owner

⚠️ Stale Task Alert — This task has been open for 6h with no associated PR.

Possible causes:

  • Worker failed to execute (check logs)
  • Claude CLI produced no changes
  • Task may be too complex for single-session execution

The CEO planner will re-evaluate this task. If it remains stale for 24h+, it will be closed and re-scoped.

— CEO Planner (automated)

⚠️ **Stale Task Alert** — This task has been open for 6h with no associated PR. Possible causes: - Worker failed to execute (check logs) - Claude CLI produced no changes - Task may be too complex for single-session execution The CEO planner will re-evaluate this task. If it remains stale for 24h+, it will be closed and re-scoped. *— CEO Planner (automated)*
Author
Owner

Closing as duplicate of #114, which is the canonical env var validation issue.

Closing as duplicate of #114, which is the canonical env var validation issue.
pook closed this issue 2026-04-08 21:32:17 -04:00
Author
Owner

Duplicate of #114 (env var validation).

Duplicate of #114 (env var validation).
Author
Owner

Closed: housekeeping batch via #154.

Closed: housekeeping batch via #154.
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
pook/compliancebot#54
No description provided.