configrc

0.1.2 • Public • Published

config-rc

Simple .*rc configuration module designed for command line applications.

Example

Setting values

'use strict';
 
var myconf = require('configrc').make('myapp');
 
myconf.set('login', 'jack');
myconf.set('password', '123456');

Saves in ~/.myapprc the following JSON:

{
  "login": "jack",
  "password": "123456"
}

Retrieving values

'use strict';
 
var myconf = require('configrc').make('myapp');
 
var login = myconf.get('login'),
    password = myconf.get('password');
 
// login <- 'jack'
// password <- '123456'

Destroying the config

'use strict';
 
var myconf = require('configrc').make('myapp');
 
myconf.destroy();

Deletes the config file ~/.myapprc.

License

MIT

Readme

Keywords

none

Package Sidebar

Install

npm i configrc

Weekly Downloads

2

Version

0.1.2

License

MIT

Last publish

Collaborators

  • olivierkaisin