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

config-chain

Package Overview
Dependencies
Maintainers
2
Versions
24
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

config-chain

HANDLE CONFIGURATION ONCE AND FOR ALL

  • 1.1.13
  • unpublished
  • latest
  • Source
  • npm
  • Socket score

Version published
Maintainers
2
Created

What is config-chain?

The config-chain package is a utility for managing hierarchical configuration data in Node.js applications. It allows you to load and merge configuration from various sources such as command-line arguments, environment variables, and configuration files. It is useful for applications that need to prioritize configurations from different sources or that need to provide a flexible configuration setup.

What are config-chain's main functionalities?

Loading and merging configurations from multiple sources

This feature allows you to create a new configuration chain and add multiple configuration sources to it. The configurations are merged, with later additions taking precedence over earlier ones. In this example, environment variables and command-line arguments are also included in the configuration chain.

{"ConfigChain": require('config-chain').ConfigChain, "cc": new ConfigChain().add({foo: 'bar'}).add({foo: 'baz', blerg: 'fluff'}).addEnv().addArg() }

Accessing configuration values

Once the configuration chain is set up, you can access configuration values using the 'get' method. This example shows how to retrieve the value of the 'foo' key from the configuration chain.

{"ConfigChain": require('config-chain').ConfigChain, "cc": new ConfigChain().add({foo: 'bar'}), "fooValue": cc.get('foo') }

Using configuration files

Config-chain supports loading configuration from JSON files. You can specify file paths to load and merge configurations from those files. In this example, two configuration files are added to the chain along with environment variables and command-line arguments.

{"ConfigChain": require('config-chain').ConfigChain, "cc": new ConfigChain().addFile('config.json').addFile('/etc/appconfig.json').addEnv().addArg() }

Other packages similar to config-chain

FAQs

Package last updated on 03 Jun 2021

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