1.0.0 • Published 4 years ago

@grouse/nestjs-config-module v1.0.0

Weekly downloads
-
License
MIT
Repository
gitlab
Last release
4 years ago

Installation

npm i -S @grouse/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 "@grouse/nestjs-config-module";

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

app.service.ts

// consumer
import { ConfigService } from "@grouse/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.

1.0.0

4 years ago