@brunost/nestjs-config-module
TypeScript icon, indicating that this package has built-in type declarations

1.0.0 • Public • Published

NestJS Environment Config Module

Installation

npm i -S @brunost/nestjs-config-module

Usage

This module expects there to exist an enviroment file in the root of the consuming projects folder.

If NODE_ENV is not set it will default to "development.env".

Example

development.env

WELCOME_MESSAGE="Hello World!"

app.module.ts

// root module
import { ConfigModule } from "@brunost/nestjs-config-module";

@Module({
  imports: [ConfigModule],
})
export class AppModule {}

app.service.ts

// consumer
import { ConfigService } from "@brunost/nestjs-config-module";

@Injectable()
export class AppService {

  constructor(
    private readonly config: ConfigService,
  ) {}

  public getHello(): string {
    return this.config.get("WELCOME_MESSAGE");
  }

}

License

Licensed under the MIT License - see the LICENSE file for details.

Package Sidebar

Install

npm i @brunost/nestjs-config-module

Weekly Downloads

0

Version

1.0.0

License

MIT

Unpacked Size

6.69 kB

Total Files

9

Last publish

Collaborators

  • lok362