Security News
38% of CISOs Fear They’re Not Moving Fast Enough on AI
CISOs are racing to adopt AI for cybersecurity, but hurdles in budgets and governance may leave some falling behind in the fight against cyber threats.
@myob-oss/config
Advanced tools
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 test/.istanbul.yml
.
npm run cover
To run the linting checking run the following command.
npm run lint
FAQs
A simple, slightly opinionated, and predictable configuration module for Node.js applications.
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
CISOs are racing to adopt AI for cybersecurity, but hurdles in budgets and governance may leave some falling behind in the fight against cyber threats.
Research
Security News
Socket researchers uncovered a backdoored typosquat of BoltDB in the Go ecosystem, exploiting Go Module Proxy caching to persist undetected for years.
Security News
Company News
Socket is joining TC54 to help develop standards for software supply chain security, contributing to the evolution of SBOMs, CycloneDX, and Package URL specifications.