Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@nestjs/config

Package Overview
Dependencies
Maintainers
3
Versions
56
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@nestjs/config

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

  • 0.4.1
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
2.1M
increased by8.46%
Maintainers
3
Weekly downloads
 
Created

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

FAQs

Package last updated on 07 May 2020

Did you know?

Socket

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
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc