chore: align api env file modes

This commit is contained in:
sunlei 2026-05-13 18:32:30 +08:00
parent 94fe524335
commit b98c49f383
3 changed files with 3 additions and 5 deletions

View File

@ -67,7 +67,7 @@ src
## 环境变量
项目默认读取 `.env`,生产环境读取 `.env.prod`。
项目默认读取 `.env.development`,生产环境读取 `.env.production`。仓库只提交 `.env.example`,真实环境配置保留在本地。
```env
DB_HOST=localhost

View File

@ -12,7 +12,7 @@
"start": "nest start",
"start:dev": "nest start --watch",
"start:debug": "nest start --debug --watch",
"start:prod": "nest build && cross-env NODE_ENV=prod node dist/main",
"start:prod": "nest build && cross-env NODE_ENV=production node dist/main",
"lint": "eslint \"{src,apps,libs,test}/**/*.ts\"",
"lint:fix": "eslint \"{src,apps,libs,test}/**/*.ts\" --fix",
"test": "jest",

View File

@ -14,9 +14,7 @@ import { SaveBodyInterceptor } from './common';
imports: [
ConfigModule.forRoot({
isGlobal: true,
envFilePath: `.env${
process.env.NODE_ENV ? `.${process.env.NODE_ENV}` : ''
}`,
envFilePath: `.env.${process.env.NODE_ENV || 'development'}`,
}),
TypeOrmModule.forRootAsync({
imports: [ConfigModule],