Socket
Socket
Sign inDemoInstall

mumba-config

Package Overview
Dependencies
0
Maintainers
1
Versions
2
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    mumba-config

Simple configuration manager.


Version published
Weekly downloads
42
decreased by-33.33%
Maintainers
1
Install size
42.1 kB
Created
Weekly downloads
 

Readme

Source

Mumba Config

A very simple configuration handler in the tradition of nconf.

Installation

$ npm install mumba-config

Examples

import {Config} from "mumba-config";

let config = new Config({
  db: {
    user: 'user',
    pass: 'password'
  }
});

config.get();          // { db: { user: 'user', pass: 'password' } }
config.get('db');      // { user: 'user', pass: 'password' }
config.get('db:user'); // 'user'
config.get('db:pass'); // 'password'

config.set('log:level', 'silly');

Loading a file or directory

import {Config, FileLoader, DirectoryLoader} from "mumba-config";

let config = new Config();

config.registerLoader(new FileLoader())
	.registerLoader(new DirectoryLoader());

config.load([{
		name: 'file',
		filePath: '/path/to/file.json'
	},
	{
		name: 'directory',
		dirPath: 'path/to/dir',
		exclude: 'local\.js'
	}])
	.then(() => {
		console.log(config.get())
	})
	.catch(console.error);

Loaders

File

Loads a JavaScript or JSON configuration file.

ParameterTypeDescription
typestringRequired Must be set to file.
filePathstringRequired The full path to the configuration file to load.

Directory

Loads a directory of JavaScript or JSON files.

ParameterTypeDescription
typestringRequired Must be set to file.
dirPathstringRequired The full path to directory containing the configuration files.
excludestringAn optional regular expression for files to exclude from the directory.

Tests

To run the test suite, first install the dependencies, then run npm test:

$ npm install
$ npm test

People

The original author of Mumba Config is Andrew Eddie.

License

Apache 2.0


© 2016 Mumba Pty Ltd. All rights reserved.

Keywords

FAQs

Last updated on 15 Jul 2016

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