Socket
Socket
Sign inDemoInstall

@nestjs/config

Package Overview
Dependencies
16
Maintainers
2
Versions
54
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    @nestjs/config

Nest - modern, fast, powerful node.js web framework (@config)


Version published
Weekly downloads
1.7M
increased by4.13%
Maintainers
2
Install size
1.60 MB
Created
Weekly downloads
 

Package description

What is @nestjs/config?

The @nestjs/config package is a configuration solution for NestJS applications. It allows developers to load and use configuration variables in a structured and scalable way. The package supports loading configuration from environment variables and custom configuration files, making it easier to manage application settings across different environments.

What are @nestjs/config's main functionalities?

Environment Variables Loading

This feature allows the application to load configuration variables from environment variables. The `forRoot` method can be used to customize the behavior, such as specifying a custom env file path.

import { ConfigModule } from '@nestjs/config';

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

Custom Configuration Files

This feature enables the application to load configuration settings from custom files. Developers can define a configuration file that exports a configuration object and load it using the `load` option.

import { ConfigModule } from '@nestjs/config';
import configuration from './config/configuration';

@Module({
  imports: [
    ConfigModule.forRoot({
      load: [configuration],
    }),
  ],
})
export class AppModule {}

Typed Configuration

This feature allows accessing configuration variables with type safety. The `ConfigService`'s `get` method can be used to retrieve configuration variables, optionally specifying the expected type.

import { ConfigService } from '@nestjs/config';

@Injectable()
class SomeService {
  constructor(private configService: ConfigService) {}

  someMethod() {
    const dbUser = this.configService.get<string>('DATABASE_USER');
  }
}

Other packages similar to @nestjs/config

Readme

Source

Nest Logo

A progressive Node.js framework for building efficient and scalable server-side applications.

NPM Version Package License NPM Downloads Coverage Discord Backers on Open Collective Sponsors on Open Collective

Description

Configuration module for Nest based on the dotenv (to load process environment variables) package.

Installation

$ npm i --save @nestjs/config

Quick Start

Overview & Tutorial

Support

Nest is an MIT-licensed open source project. It can grow thanks to the sponsors and support by the amazing backers. If you'd like to join them, please read more here.

Stay in touch

License

Nest is MIT licensed.

FAQs

Last updated on 05 Apr 2024

Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc