lark-config

3.3.2 • Public • Published

lark-config

NPM version build status Test coverage

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

/lark-config/

    Package Sidebar

    Install

    npm i lark-config

    Weekly Downloads

    5

    Version

    3.3.2

    License

    MIT

    Unpacked Size

    18.9 kB

    Total Files

    18

    Last publish

    Collaborators

    • viringbells