Created
November 10, 2018 11:36
-
-
Save cristoni/c0c591ce024580fbdd965b41a9664dd0 to your computer and use it in GitHub Desktop.
Config module for NestJS
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { Module } from '@nestjs/common'; | |
import { ConfigService } from './config.service'; | |
@Module({ | |
providers: [ | |
{ | |
// Load the service as a provider | |
provide: ConfigService, | |
// Tells the service which file to load upon initialization | |
useValue: new ConfigService(`${process.env.NODE_ENV || 'development'}.env`), | |
}, | |
], | |
// Expose it to any other module it implement it | |
exports: [ConfigService], | |
}) | |
export class ConfigModule {} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment