xconfigjs

2.0.1 • Public • Published

xconfigjs

A super simple & flexible & useful config module.

Install

npm i xconfigjs --save

Usage

var config = require('xconfigjs');

By default, require('xconfigjs') will bubbling find config (or custom) directory from process.cwd().

See test.

After v1.0.0, support yaml config file.

Example

config/default.js

module.exports = 'default';

config/test.js

module.exports = 'test';

config/production.js

module.exports = 'production';

====================================

node app

require('xconfigjs'); //=> 'default'
NODE_ENV=test node app

require('xconfigjs'); //=> 'test'
NODE_ENV=production node app

require('xconfigjs'); //=> 'production'

or:

NODE_ENV=production node app --host=localhost --port=3000

Test

npm test

License

MIT

Package Sidebar

Install

npm i xconfigjs

Weekly Downloads

0

Version

2.0.1

License

MIT

Last publish

Collaborators

  • xhinliang