Security News
Maven Central Adds Sigstore Signature Validation
Maven Central now validates Sigstore signatures, making it easier for developers to verify the provenance of Java packages.
json4config
Advanced tools
A simple and minimalist environment-aware configuration provider
Run npm i json4config
and start using it :-)
Use the following code to conveniently get config values for a environment (in this case prod
- see end of first line):
const cfg = require('json4config')('./config.json', 'prod');
console.log(cfg.get('mailing.host'));
console.log(cfg.get('mailing.port', 25)); // <-- Default fallback value
console.log(cfg.config); // <-- Raw config object
from a central config.json
file with the following contents:
{
"dev": {
"mailing": {
"host": "localhost"
},
"port": 10001
},
"prod": {
"extends": "dev",
"mailing": {
"host": "smtp.gmail.com"
},
"port": 80
},
"app.mydomain.tld": {
"extends": "prod",
"mailing": {
"host": "custom-smtp.myserver.foo",
"port": 465,
"useSSL": true
}
}
}
config.json
for a NodeJS applicationextends
inside an environment configuration to get all config keys from the provided environment. This way overwriting just only some values is very easy-e prod
or --env prod
or place it inside the NODE_ENV
system environment variableget(key, defaultValue)
with a default value or by using the config
key which contains the entire objectexamples/
Tests need to be extended, to also test the commandline switches and NODE_ENV
system variable
This documentation needs to be extended with the optional parameters and the normalization feature of environment names
FAQs
A simple and minimalist environment-aware configuration provider
We found that json4config 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
Maven Central now validates Sigstore signatures, making it easier for developers to verify the provenance of Java packages.
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.