Security News
Node.js EOL Versions CVE Dubbed the "Worst CVE of the Year" by Security Experts
Critics call the Node.js EOL CVE a misuse of the system, sparking debate over CVE standards and the growing noise in vulnerability databases.
Combines nconf, recurpolate, and declarative JSON "extends"
syntax to create an extremely useful configuration loader.
All the value packed into appfig
is demonstrated in ./example
, which is summarized for your reading below. appfig
is compatible with Node 8+. Enjoy.
config/default.json
{
"port": 3000,
"logLevel": "debug",
"services": {
"users": "http://${host}/users"
}
}
config/development.json
{
"extends": "default",
"host": "dev.example.com"
}
config/production.json
{
"extends": "default",
"port": 3001,
"logLevel": "info",
"host": "www.example.com"
}
index.js
process.env.APP_ENV = process.env.APP_ENV || 'development';
const { APP_ENV } = process.env;
const config = require('appfig')(__dirname + `/config/${APP_ENV}.json`);
console.log(config.get('port'));
console.log(config.get('logLevel'));
console.log(config.get('services:users'));
Starting your application with development configuration
$ node index.js
3000
trace
http://dev.example.com/users
Starting your application with production configuration
$ APP_ENV=production node index.js
3001
info
http://www.example.com/users
appfig
is released under the MIT License.
FAQs
An extremely useful configuration loader.
We found that appfig 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
Critics call the Node.js EOL CVE a misuse of the system, sparking debate over CVE standards and the growing noise in vulnerability databases.
Security News
cURL and Go security teams are publicly rejecting CVSS as flawed for assessing vulnerabilities and are calling for more accurate, context-aware approaches.
Security News
Bun 1.2 enhances its JavaScript runtime with 90% Node.js compatibility, built-in S3 and Postgres support, HTML Imports, and faster, cloud-first performance.