Skip to content

Add missing environment variable validation to env.validation.ts #88

Description

@Hallab7

Description

The .env.example file contains 20+ environment variables for rate limiting, retention, cron schedules, and salt versioning that are not validated in env.validation.ts. This allows invalid configuration to reach production.

Add complete Zod schema validation for all environment variables documented in .env.example including AUTH_RATE_LIMIT_, RETENTION_, cron expressions, and VERIFICATION_HASH_SALT_V* variables.

Acceptance criteria

  • Every variable in .env.example has corresponding validation in env.validation.ts
  • Invalid values fail fast at startup with clear error messages
  • Cron expressions are validated with proper regex patterns
  • Retention day values are bounded (1-3650 days)
  • Rate limit windows and counts have sensible bounds

Testing requirements

  • Validation catches invalid cron syntax
  • Validation rejects out-of-range retention values
  • npm run lint and npm run test pass

Files

src/config/env.validation.ts, .env.example, src/config/env.validation.spec.ts

Suggested branch

feat/complete-env-validation

Suggested commit message

feat(config): add comprehensive environment validation

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workingdocumentationImprovements or additions to documentationenhancementNew feature or request

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions