4.0.0 • Published 5 months ago

config-lite v4.0.0

Weekly downloads
106
License
MIT
Repository
github
Last release
5 months ago

config-lite

A super simple & flexible & intuitive config module, support yaml & toml.

Install

$ npm i config-lite --save

Usage

const config = require('config-lite')(__dirname);

or:

const config = require('config-lite')({
  filename: 'test',
  config_basedir: __dirname,
  config_dir: 'config'
});

Options

  • filename: config file name, default: default, support: ['.js', '.json', '.node', '.yaml', '.yml', '.toml'].
  • config_basedir: directory for begining bubbling find config directory.
  • config_dir: config directory name, default: config.
  • config: default config object that overwrite config file.

Priority

environment option > custom option > default option

For example:

$ NODE_ENV=production NODE_CONFIG='{"port":3000}' node app.js

loading order:

NODE_CONFIG='{"port":3000}' > opt.config > production config file > default config file

Environment Variables

  • NODE_ENV -> filename
  • CONFIG_BASEDIR || NODE_CONFIG_BASEDIR -> config_dirname
  • CONFIG_DIR || NODE_CONFIG_DIR -> config_dir
  • CONFIG || NODE_CONFIG -> config

Test

$ npm test

License

MIT

4.0.0

5 months ago

3.0.0

4 years ago

2.1.0

7 years ago

2.0.0

7 years ago

1.6.0

7 years ago

1.5.0

8 years ago

1.4.1

8 years ago

1.4.0

8 years ago

1.3.0

8 years ago

1.2.1

8 years ago

1.2.0

9 years ago

1.1.0

9 years ago

1.0.0

9 years ago

0.2.0

9 years ago

0.1.0

9 years ago