Security News
Oracle Drags Its Feet in the JavaScript Trademark Dispute
Oracle seeks to dismiss fraud claims in the JavaScript trademark dispute, delaying the case and avoiding questions about its right to the name.
confucious
Advanced tools
App configuration management. Kind of like nconf, but easier to use, predicable and more flexible.
A simple, stack-based, key/value configuration manager.
Kind of like nconf, but easier to use, predicable and more flexible.
npm install --save confucious
var conf = require('confucious');
conf.set("key", "some-value");
var value = conf.get("key");
A hash of keys/values can be pushed on top of the 'key/value stack'.
conf.push({
"key": "some-value",
});
When you get a value that is defined higher in the stack, that value overrides underlying values.
var value = conf.get("key"); // Search stack for a value for "key"
When you set a key/value, the value is modified at the top level of the stack:
conf.set("key", "some-other-value"); // Set values on top of the stack.
The last key/values hash that was pushed can be popped.
conf.pop(); // Revert to stack level underneath.
When you call set
and clear
these functions operate (setting or clearing a key/value) at the top level of the stack. This means whatever level you pushed on the stack last will be modified. If you pop that level from the stack the modifications will be lost.
To persist values you may want to set and clear global values:
conf.setGlobal('some-key', 'some-value');
conf.clearGlobal('some-key');
When you set a global it sets the value at the bottom level of the stack. So the value persists regardless of what other stack levels you push or pop.
Note that global key/values are same as any other key/value with the exception that they are at the bottom of the stack. Therefore they can be overridden by key/values higher in the stack.
Similar to nconf, Confucious supports the colon key (:) as a separator for getting, setting and clearing nested key/values.
conf.push({
"some-key": {
"some-nested-key": "some-value",
}
});
var value = conf.get("some-key:some-nested-key"); // == "some-value"
conf.set("some-key:some-nested-key", "some-other-value");
conf.clear("some-key:some-nested-key");
Dump the entire current configuration to JavaScript object (good for debugging):
var curConfiguration = conf.toObject();
console.log(curConfiguration);
conf.pushJsonFile("path/to/file.json");
conf.pushEnv();
conf.pushArgv();
FAQs
App configuration management. Kind of like nconf, but easier to use, predicable and more flexible.
The npm package confucious receives a total of 22 weekly downloads. As such, confucious popularity was classified as not popular.
We found that confucious demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 2 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Oracle seeks to dismiss fraud claims in the JavaScript trademark dispute, delaying the case and avoiding questions about its right to the name.
Security News
The Linux Foundation is warning open source developers that compliance with global sanctions is mandatory, highlighting legal risks and restrictions on contributions.
Security News
Maven Central now validates Sigstore signatures, making it easier for developers to verify the provenance of Java packages.