Skip to content

larkjs/lark-config

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

93 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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

Releases

No releases published

Packages

No packages published