Nest schematic should setup @nestjs/config
See original GitHub issueDescription
Currently, the Nest schematic generates environment.ts files (because it extends the Node schematic). However, there is no explanation in the docs how to use the environment.ts files. The generation of env.ts files by the schematic implies that we should be using custom config files in Nest and not *.env files: https://docs.nestjs.com/techniques/configuration#custom-configuration-files
The ask is that the schematic sets up nestjs/config to use the generated environment.ts files. (happy to open a PR for this if solution is acceptable)
Motivation
Bring config management inline with how Angular manages configs.
Suggested Implementaion
import { ConfigModule } from '@nestjs/config'; import { environment } from '../environments/environment'; ... imports: [ ConfigModule.forRoot({ load: [() => environment], isGlobal: true }), ],
Alternate Implementations
Issue Analytics
- State:
- Created 3 years ago
- Comments:7
Before this issue gets fixed I’m asking this here: I’m progressively moving projects inside a NX repo. I’m stuck for a Nestjs project. We use config files in a
config
folder and we include them using:ConfigModule.load(resolve(__dirname, "config", "**", "!(*.d).{ts,js}")),
The problem is: the config folder is not present in the dist directory when I usenx serve
. Do you have a quick fix for this? A configuration so the src/config folder gets transpiled? I think theAsset
folder has a similar behavior but I have no idea how to do it 😬 . Thanks !I miss this issue !