Socket
Socket
Sign inDemoInstall

config-ini

Package Overview
Dependencies
1
Maintainers
1
Versions
5
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    config-ini

async config.ini loader (with optional override config.dev.ini)


Version published
Weekly downloads
19
decreased by-44.12%
Maintainers
1
Install size
29.6 kB
Created
Weekly downloads
 

Readme

Source

config-ini

Description

Easy-to-use INI config file management built on top of iniparser

What it does

Loads INI file (or files in specific order) and makes contents available in a singleton object.

Example 1 - default behavior

Attempt to load config.ini from the current working directory. Contents of your-script.js: var config = require('config-ini');

config.load(function (err) {
  if (err) {
    throw new Error(err); // File not found
  }

  console.log('My config:', config);
});

On your terminal run: # node your-script.js

Example 2 - specific config file

Load specified ini file. Using the code from "Example 1", run: # node your-script.js --config=configs/my-file.ini

Example 3 - multiple config files

Using the code from "Example 1", run: # node your-script.js --config=my-file.ini --config=override.ini

Example 4 - specify files in the code

Contents of your-script.js: var config = require('config-ini');

config.load(['my-file.ini', 'override.ini'], function (err) {
  if (err) {
    throw new Error(err); // File not found
  }

  console.log('My config:', config);
});

On your terminal run: # node your-script.js

Install

npm install config-ini

Notes

  • You may combine command line options and in-code calls. In that case, command line options take precedence.
  • .load() method on the required singleton instance will be removed (or will be repaced with a "load" section if any) after loading configuration

Keywords

FAQs

Last updated on 17 Jan 2014

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