Registry / devops / confabulous

confabulous

JSON →
library2.1.2jsnpmunverified

Confabulous is a pluggable, hierarchical, asynchronous configuration loader and post-processor for Node.js. Version 2.1.2 is the current stable release. It supports loading config from command line arguments, environment variables, JSON/JavaScript files, HTTP endpoints, Vault, etcd, and PostgreSQL. Config sources can be watched for changes, and post-processors can transform loaded data (e.g., decrypt secrets or unflatten objects). It merges configs recursively using a customizable merge strategy. Compared to alternatives like node-config or dotenv, Confabulous emphasizes async loading, hierarchical merging, and extensive source support.

npm install confabulous
INSTALL
IMPORT
SIG · CONFABULOUS
C
confabulous
devopsjavascriptv2.1.2
harness data pending
Install & Compatibility
Where this runs

No compatibility data collected yet for this library.

Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

Confabulous
const Confabulous = require('confabulous')
import { Confabulous } from 'confabulous'
Confabulous is a CommonJS module and does not export ESM. Use require().
loaders
const { loaders } = require('confabulous')
const loaders = require('confabulous').loaders
Both destructured and dot-access work; destructuring is idiomatic.
postProcessors
const { postProcessors } = require('confabulous')
import postProcessors from 'confabulous'
postProcessors is a named export from the CommonJS module.

Shows how to create a Confabulous instance, add loaders for args, env, and JSON files, apply a post-processor to unflatten keys, and handle the final configuration.

const Confabulous = require('confabulous'); const { loaders, postProcessors } = Confabulous; const conf = new Confabulous() .add(config => loaders.args()) .add(config => loaders.env()) .add(config => loaders.require({ path: './config/default.json' })) .add(config => loaders.require({ path: './config/production.json', mandatory: false })) .postProcessor(postProcessors.unflatten()) .end((err, config) => { if (err) { console.error('Failed to load config', err); process.exit(1); } console.log('Loaded config:', config); // Your application logic here });
Debug
Known issues
deprecatedloaders.http() is deprecated in favor of loaders.https() for security reasons.
fix
Replace loaders.http({...}) with loaders.https({...}).
affects: >=1.0.0
breakingVersion 2.0 dropped support for Node.js < 10. The callback signature changed from (err, config) to (err, config) with no extra arguments.
fix
Update to Node.js >= 10 and adjust any code relying on removed callback parameters.
affects: <2.0.0
gotchaThe 'args' loader parses command-line arguments using minimist. Named arguments with hyphens (--my-option) become camelCase keys (myOption).
fix
Access the key as config.myOption, not config['my-option'].
affects: >=1.0.0
gotchaIf a loader defines 'mandatory: true' and the source is missing, the config loading fails with an error. This applies to loaders.require, loaders.http, loaders.https, etc.
fix
Set mandatory: false for optional sources to avoid blocking startup.
affects: >=1.0.0
breakingIn version 2.1.0, the 'watch' option behavior for the 'require' loader changed: it now always watches the file instead of requiring an explicit true value.
fix
Remove any watch: true option from require loader config; it is now the default.
affects: >=2.1.0 <2.1.0
Errors
Common errors & fixes
Cannot find module 'confabulous'
Package not installed or installed globally.
fix
Run 'npm install confabulous' in your project directory.
TypeError: confabulous.add is not a function
Confabulous is not instantiated with 'new' or the variable is misassigned.
fix
Ensure you use 'new Confabulous()' and that your variable references the instance.
Error: ENOENT: no such file or directory, open './config.json'
A required config file path is incorrect or file is missing.
fix
Double-check the path passed to loaders.require() or set mandatory: false if the file is optional.
TypeError: Cannot read property 'args' of undefined
loaders is not destructured correctly.
fix
Use 'const { loaders } = require('confabulous');' or 'const loaders = require('confabulous').loaders;'.
Warning: loader 'http' is deprecated, use 'https' instead
Using loaders.http() which has been deprecated for security.
fix
Replace loaders.http() with loaders.https() and update options accordingly.
Upgrade
Version history
2.1.2latest on npm
Audit
Dependencies
ramdarequiredUsed for deep merging configuration objects (mergeDeepRight) and other utilities.
Agent activity
2 hits · last 30 days
node
2
Resources
confabulous — npm install confabulous · libregistry