Skip to content

Fail application startup when required env vars are missing in production #85

@RonaldRonnie

Description

@RonaldRonnie

Description:

Currently validate_env_vars() and check_required_vars() in app/utils/config.py only print warnings when NCBI_API_KEY, EMAIL, or LLM keys are missing. The app still starts, which leads to runtime errors and confusing health/analysis failures.

Acceptance criteria:

  • When ENVIRONMENT=production (or a dedicated STRICT_ENV=true), the application exits with a non-zero code at startup if any of the required vars are missing: NCBI_API_KEY, EMAIL, and at least one LLM key (e.g. GEMINI_API_KEY).
  • Log a clear message listing the missing variables and how to set them (e.g. .env or export).
  • In development (default or ENVIRONMENT=development), keep current behavior (warn but do not exit).

Files to consider: app/utils/config.py, main.py, Docker CMD/entrypoint.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions