
Product
Rust Support Now in Beta
Socket's Rust support is moving to Beta: all users can scan Cargo projects and generate SBOMs, including Cargo.toml-only crates, with Rust-aware supply chain checks.
Confisto is a simple configuration loader for node.
The API is fairly simple. The module exports a single function confisto
.
file
: File to load that contains the main configuration.dir
: Directory to read and load that contains many seperate configuration files. Optional.defaults
: Object with default values or path (string) to a file with default values. Optional.parser
: Parser to use while loading files Optional. (default 'json'
)Function to call when done loading configurations.
err
: Error in case of an errorconfigs
: Object containing the result of merging the configuration files togethervar confisto = require('confisto')
confisto({
file: 'my.conf'
, defaults: {
logPath: '/var/log/my/errors.log'
, dbconn: {
host: 'db.example.com'
, port: 1337
}
, users: ['dan']
}
}, function (err, config) {
if (err) {
console.error(err)
process.exit()
}
console.log(config)
})
my.conf
{ "logPath": "templog.log
"dbconn": {
"host": "localhost"
"user": "root"
}
"users": ["joe"]
}
will print
{ logPath: 'templog.log'
, dbconn: {
host: 'localhost'
, user: 'root'
}
, users: ['dan', 'joe']
}
Keep configuration object config
under namespace ns
so that it can be obtained from other files.
Get the configuration object of namespace ns
// file1.js
var confisto = require('confisto')
, func = require('./file2')
confisto({
file: 'main.conf'
}, function (err, config) {
// handle err
confisto.keep('main', config)
func()
})
// file2.js
var confisto = require('confisto')
module.exports = function () {
var mainConfig = config.get('main')
console.log(mainConfig.logFile)
}
FAQs
Configuration loader with directory support and a clean API
We found that confisto demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer 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.
Product
Socket's Rust support is moving to Beta: all users can scan Cargo projects and generate SBOMs, including Cargo.toml-only crates, with Rust-aware supply chain checks.
Product
Socket Fix 2.0 brings targeted CVE remediation, smarter upgrade planning, and broader ecosystem support to help developers get to zero alerts.
Security News
Socket CEO Feross Aboukhadijeh joins Risky Business Weekly to unpack recent npm phishing attacks, their limited impact, and the risks if attackers get smarter.