Put in order · NestJS course · Module 1: NestJS Basics
Configuration Source Priority
The application registers ConfigModule.forRoot({ envFilePath: ['.env.production', '.env'] }). Arrange the sources of a value for the same key from highest to lowest priority:
Items to put in order
- Values from .env.production (the first file in envFilePath)
- The default value in configService.get('KEY', defaultValue)
- Values from the .env file
- Operating system environment variables
Show the answer
Correct order:
- Operating system environment variables
- Values from .env.production (the first file in envFilePath)
- Values from the .env file
- The default value in configService.get('KEY', defaultValue)