@brunost/nestjs-config-module
v1.0.0
Published
NestJS environment config utility module
Downloads
4
Maintainers
Readme
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.