lark-config
v3.3.2
Published
lark config module
Downloads
32
Readme
lark-config
This is a tool to load configs from files
How to install
$ npm install --save lark-config
How to use
const config = new Config();
await config.load('configs');
This will load all files (.js, .json, .yaml, .yml, .node) in directory 'configs'.
Then you can easily get/check/remove a config by path:
config.get("path.to.file.foo.bar"); // nearly same as require('path/to/file').foo.bar
config.has("path.to.file.foo.bar");
config.delete("path.to.file.foo.bar");
config.set("path.to.file.foo.bar", "new-value");
If you want to switch the config by environment, use the second param as tag:
await config.load('configs', '@online');
It will use config named as foo@online
rather than foo
if exists