npm install @syukurilexs/nestjs-config
Import ConfigModule
:
@Module({
imports: [ConfigModule],
providers: [...],
})
export class AppModule {}
Inject ConfigService
:
@Injectable()
export class YourService {
constructor(private readonly config: ConfigService) {}
show() {
return this.config.get('MYVAR');
}
}
Declare env variable NODE_ENV=development.env
In order to use this package you need to create config folder on your root directory and then create your .env file
- development.env
- production.env
See Changelog for more information.
Contributions welcome! See Contributing.
Syukur Kassim (Syukurilexs on Linkedin)
Licensed under the MIT License - see the LICENSE file for details.