@levz0r/uconfig
v1.0.2
Published
Micro Configurations Reader for Masses
Downloads
4
Readme
- The smallest configuration reader in the world.
- Works with any JSON file as configuration source.
- Has only one external dependency.
Getting Started
Install uConfig using npm
:
npm i uconfig
Usage
Create a JSON file which will hold your configuration.
For example:
{
"DB": {
"USERNAME": "user",
"PASSWORD": "password"
},
"API": {
"ENDPOINT": "http://example.com"
}
}
Initialize uConfig instance:
const uConfig = require("@levz0r/uconfig").default;
const config = new uConfig(/* Path to configuration JSON */);
Read configuration value:
config.get("DB.USERNAME")
Fallback value:
config.get("DB.PORT", 27017)