In this lesson, we add configuration to the NestJS API using a .env
file, which Nx Workspace supports out of the box.
After adding the @nestjs/config
and joi
dependencies, we define a configuration and validation schema.
These files are loaded into the ConfigModule
, that we import in CoreModule
and the values in our .env
file are now validated using our schema.
We can now import the ConfigService
and use it to get properties from our configuration.
Dumb question, since I'm new to egghead: does this lesson belong to a course, and how do I figure it out? Thanks!