Modules, providers, DI, pipes, guards, interceptors and testing in Nest.
Work out the final configuration values the way @nestjs/config
combines its sources.
entryPoint(processEnv, files, defaults):
Implement the lookup behind configService.get('database.host', fallback)
for a nested configuration object.
entryPoint(config, path, fallback):
How do you read settings like a database URL or a port from a .env
file in a NestJS app using @nestjs/config? Name the module call, the
service you inject and the method you use to read a value.
A teammate commits .env with the production database password "so
everyone has the right settings". What is wrong with that, and what do
teams normally do instead?
ConfigService works in AppModule, but in UsersModule Nest fails at
startup saying it cannot resolve ConfigService for UsersService.
Why, and what are two ways to fix it?
.env contains PORT=3000 and CACHE_ENABLED=false. What does this
code print, and why? How do you get real numbers and booleans?