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.
@myob-oss/config
Advanced tools
A simple, slightly opinionated, and predictable configuration module for Node.js applications.
A simple, slightly opinionated, and predictable configuration module for Node.js applications.
To install the module in your project use the following command.
npm install @myob-oss/config
To use the module (after you have installed it in your project), you only need to require it, and it exposes the configuration as an Object.
const config = require('@myob-oss/config');
console.log(config.configurationFile); // prints "runtime" from the example below.
Yes, this is another configuration module. We know there are others out there. We created this configuration module to simplify and unify the way in which we configured our node applications to work with our various environments including our cloud infrastructure, continuous delivery pipelines and running our apps locally.
The benefits we have seen from using this configuration module are:
This configuration module has also been mentioned in the Under The Hood series of blog posts.
This module uses the environment variable NODE_ENV
to determine which configuration file to load.
The module assumes that all the configuration files are in JSON format and in the /config
folder at the top level of the project. The JSON files can have comments in them, as the module uses the json5 module to parse the config files.
The module loads 3 configuration files in the following order (each overwrites the previous if they have the same key):
Each configuration file will override values from the previous file. For example:
default.json
{
"configurationFile": "default",
"disableConsole": false
}
production.json
{
"debugLevel": "trace"
}
runtime.json
{
"configurationFile": "runtime",
"validHosts": ["localhost", "example.com"]
}
The resulting configuration will be:
{
"configurationFile": "runtime",
"disableConsole": false,
"validHosts": ["localhost", "example.com"],
"debugLevel": "trace"
}
This uses the deepmerge module to do the merging of the configuration objects.
To run the tests use the following command.
npm test
To run the coverage scanner and generate coverage report use the following command. It fails if the threshold coverage has not passed. The threshold settings are stored in the file .nycrc
. Please note that the thresholds configured are per-file.
npm run cover
To run the linting check run the following command.
npm run lint
FAQs
A simple, slightly opinionated, and predictable configuration module for Node.js applications.
The npm package @myob-oss/config receives a total of 43 weekly downloads. As such, @myob-oss/config popularity was classified as not popular.
We found that @myob-oss/config 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
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.