Skip to content

xp-fly/nestjs-config

Repository files navigation

Description

config module for nestjs using dotenv and jsyaml

Install

npm install nestjs-configure --save or yarn add nestjs-configure

Basic usage

use .env or bootstrap.yml manage config

.env

test=1
ip=localhost

bootstrap.yml

# bootstrap.yml
this: is
a:
  - YAML
  - example

# config 
{ this: 'is', a: [ 'YAML', 'example' ] }
import { Module } from '@nestjs/common';
import { ConfigModule } from 'nestjs-configure';

@Module({
  imports: [ConfigModule.load()]
})
export class AppModule {
  
}
import { Injectable } from '@nestjs/common';
import { ConfigService } from 'nestjs-configure';

@Injectable()
class TestService {
    constructor(private config: ConfigService) {}

    getConfig() {
        return this.config.getConfig();
    }
}

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published