Skip to content

Instantly share code, notes, and snippets.

@darwinsubramaniam
Created July 18, 2020 07:58
Show Gist options
  • Save darwinsubramaniam/13d64b7794da8be9dc3928561429709d to your computer and use it in GitHub Desktop.
Save darwinsubramaniam/13d64b7794da8be9dc3928561429709d to your computer and use it in GitHub Desktop.
NestJs Config , Loading different Env File
import { Module } from '@nestjs/common';
import { ConfigModule } from '@nestjs/config';
import { join } from 'path';
require('dotenv').config();
@Module({
imports: [
ConfigModule.forRoot({
envFilePath: process.env.APP_ENV === 'dev' ?
join(process.cwd(), 'environment', 'dev.env') :
join(process.cwd(), 'environment', 'prod.env'),
isGlobal: true,
})
],
controllers: [],
providers: [],
})
export class AppModule { }
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment