Skip to content

Create input validation utility for environment variables #43

@coderabbitai

Description

@coderabbitai

Description

Create a utility function in services/utils/ to validate required environment variables at service startup, providing clear error messages when config is missing.

Context

Services currently fail with cryptic errors when environment variables are missing. A validation utility would provide better error messages and fail-fast behavior.

Tasks

  • Create services/utils/env_validator.py
  • Implement validate_env_vars(required_vars: List[str]) function
  • Function should:
    • Check if required env vars are set
    • Raise helpful error if missing (list all missing vars)
    • Optionally validate format (e.g., port numbers are integers)
    • Return a dict of validated values
  • Add unit tests in tests/unit/test_env_validator.py
  • Update services/ingest/app.py to use the validator

Acceptance Criteria

  • New module created with proper docstrings
  • Function has >90% test coverage
  • Provides clear error messages
  • Example integration in ingest service
  • Does not break existing functionality

Resources

Estimated Time

90-120 minutes

Metadata

Metadata

Labels

enhancementNew feature or requestgood first issueGood for newcomerspythonPull requests that update python code

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions