@cnwangjie/conf
v1.1.1
Published
Lightweight Node.js configuration with enough feature.
Downloads
14
Readme
config.js
Lightweight Node.js configuration with enough feature.
Installation
yarn add @cnwangjie/conf
Usage
const conf = require('@cnwangjie/conf')
// load config file in bootstrap
conf().load('config.json')
// you can use absolute path or path relative with current path
// besides, you can load any type file of JS, YAML, TOML, ENV and you just need
// install corresponding module
// then you can get the config in every file by require config.js
conf('server.port')
conf().get('server.port')
conf.server.port
// you can use any type of style above
// even you can set separator you like by following way
conf().separator = ':'
conf('server:port')
You need to install corresponding module if you want to use other suffix config file.
|suffix|module| |:-:|:-:| |.yml|js-yaml| |.yaml|js-yaml| |.env|dotenv| |.toml|toml|