Security News
The Unpaid Backbone of Open Source: Solo Maintainers Face Increasing Security Demands
Solo open source maintainers face burnout and security challenges, with 60% unpaid and 60% considering quitting.
Load config from a javascript object.
When JSON is too limiting; you need to dynamically set values, include comments or external files in your configuration, jsconf is the tool for you.
npm i jsconf --save
load from a file
var jsconf = require('jsconf')
var config = jsconf.load('/path/to/config.jsconf')
console.log(config)
parse a string
var config = jsconf.parse('{x: +new Date}')
console.log(config)
load from a file with exposed variables
var jsconf = require('jsconf')
// The jsconf object will now have access the variable `cwd`
jsconf.context.cwd = process.cwd()
var config = jsconf.load('/path/to/config.jsconf')
console.log(config)
A jsconf file contains a single javascript object declaration. There cannot be any executable code outside the object. Comments are allowed anywhere.
These are the perks:
Dynamic Properties
{
created: +new Date,
nuance: ~~(100 + (Math.random() * 1000)),
guid: (function(x){return x % 200})(+new Date) // closure FTW!
}
C-style Comments
/**
* Database Configuration
* blah blah blah
*/
{
mysql: {
host: '127.0.0.1',
port: 3306,
user: 'DB_USER',
password: 'DB_PASS',
database: 'DB_NAME',
//socketPath: '/opt/local/var/run/mysql55/mysqld.sock',
// Settings
connectionLimit: 10, // Max number of connections to create at once
multipleStatements: true, // Allow multiple mysql statements per query
},
}
Include External Files
{
https: {
port: 443,
creds: {
'key': fs.readFileSync('./app/config/ssl-certs/server.key'),
'cert': fs.readFileSync('./app/config/ssl-certs/server.crt'),
'ca': fs.readFileSync('./app/config/ssl-certs/ca.crt'),
'requestCert': true,
'rejectUnauthorized': false
}
},
}
FAQs
Load config from a javascript object
The npm package jsconf receives a total of 2 weekly downloads. As such, jsconf popularity was classified as not popular.
We found that jsconf 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.
Security News
Solo open source maintainers face burnout and security challenges, with 60% unpaid and 60% considering quitting.
Security News
License exceptions modify the terms of open source licenses, impacting how software can be used, modified, and distributed. Developers should be aware of the legal implications of these exceptions.
Security News
A developer is accusing Tencent of violating the GPL by modifying a Python utility and changing its license to BSD, highlighting the importance of copyleft compliance.