Skip to content

Add Environment Variable Validation During Application Startup #212

Description

@jikrana1

Summary

The application depends on several required environment variables such as JWT secrets, database configuration, Redis configuration, and Google credentials. Currently, there is no centralized validation to ensure these variables are defined before the application starts.

This can lead to runtime failures that are difficult to debug.

Proposed Changes

  • Create a centralized environment validation utility.
  • Validate all required environment variables during application startup.
  • Display clear error messages for missing or empty environment variables.
  • Prevent the application from starting if required variables are missing.
  • Keep the validation logic easy to maintain and extend.

Environment Variables to Validate

  • NODE_ENV
  • PORT
  • JWT_SECRET
  • JWT_REFRESH_SECRET
  • DB_HOST
  • DB_PORT
  • DB_NAME
  • DB_USER
  • DB_PASSWORD
  • REDIS_HOST
  • REDIS_PORT
  • GOOGLE_APPLICATION_CREDENTIALS

Benefits

  • Prevents runtime configuration errors.
  • Improves developer experience.
  • Makes application startup more reliable.
  • Provides clear feedback for missing configuration.
  • Improves overall application stability.

Metadata

Metadata

Assignees

Labels

SSoC26Program label for Social Summer of Code Season 5.

Type

No type

Fields

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