StaticforInitializes the module with a validation class for environment variables.
The type describing the shape of the environment variables.
The class that describes and validates the expected environment variables.
A dynamic module ready to be imported into the application.
Environment configuration module.
This module initializes the configuration via a custom validator and makes validated environment variables available throughout the application.
It leverages NestJS's ConfigModule and integrates a class-based validation using class-transformer and class-validator. The validated environment variables can then be injected anywhere in the app via the EnvironmentVariablesProvider.
Example