cz
A simple config utility for Nodejs
Table of contents
Quick start
const Cz = ;const config = ; // Loads the config file into Czconfig; // Sets Cz's default value for "port" to 4000// If the value is unset using config.set('port', null) then Cz will fall back to 4000config; // Sets Cz to { random: 'random value' }config; // This will return the whole config object currently loadedconsole; // This will get { db:{ host:{} } } from the config objectconsole; // Here's a typical example of how this is usedconsole; // Cz provides a little helper to join gets for youconsole;
Status
Documentation
Cz sets defaults()
as the most bottom object and applies all changes to the config object on top of that meaning anywhere in your app you can use config.defaults({})
to override the default values.
const config = ; config; config;config; // 5000 config;config; // 4000
To reset defaults just use config.defaults({});
To reset the config itself we provide config.reset();