New Research: Supply Chain Attack on Axios Pulls Malicious Dependency from npm.Details
Socket
Book a DemoSign in
Socket

json-config-loader

Package Overview
Dependencies
Maintainers
1
Versions
2
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

json-config-loader

An opinionated json config loader

latest
npmnpm
Version
1.1.0
Version published
Maintainers
1
Created
Source

An Opinionated Config Loader

Loads config files from a namespace in common linux directories. Also supports loading environment dependant config files. This modules uses require so is syncronous and supports anything that can be required.

Install

$ npm install --save json-config-loader

Basic Usage

var loadConfig = require('json-config-loader');

var config = loadConfig({
	namespace: 'musicmap'
});

/*
Config is now an object containing these files merged togeter:

/etc/musicmap/main.json
/etc/musicmap/dev.json
/usr/local/etc/musicmap/main.json
/usr/local/etc/musicmap/dev.json
*/

Advanced Options

var config = loadConfig({
	namespace: 'musicmap',
	mainfile: 'custom',
	extention: 'js',
	env: 'production',
	configDirectories: [
		// Load config from app dir
		// /usr/local/src/musicmap/app/config
		__dirname + '/config',
		'/etc',
		'/usr/local/etc'
	]
}, {
	// Default config options
	defaults: 'foobar'
}, {
	// Override config values
	overrides: 'foobaz'
});

/*
Config is now an object containing these files merged togeter:

/usr/local/src/musicmap/app/config/musicmap/custom.js
/usr/local/src/musicmap/app/config/musicmap/production.js
/etc/musicmap/custom.js
/etc/musicmap/production.js
/usr/local/etc/musicmap/custom.js
/usr/local/etc/musicmap/production.js
*/

Keywords

json

FAQs

Package last updated on 19 Jul 2015

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