Security News
PyPI Introduces Digital Attestations to Strengthen Python Package Security
PyPI now supports digital attestations, enhancing security and trust by allowing package maintainers to verify the authenticity of Python packages.
config-ninja
Advanced tools
A quick and easy way to read in config files from disk depending on the enviroment. By default Config Ninja uses the NODE_ENV
environment variable to determin whether we are running in production
mode, otherwise development
mode is assumed.
Important: The production
config is always the default config. If you specify another enviroment, Config Ninja will copy the properties from that environment into the production config, overwriting any values that already exist. Nested properties will be respected. No changes are saved to disk.
// On application load prepare the ninja.
var config = require('config-ninja').init('/path/to/cfg/dir/');
// In another module we need config again...
var config = require('config-ninja');
// Use our config.
console.dir(config);
console.log('Super:', config.nested.super);
By default production
and development
environment strings are understood. If you have additional environments you can override the environment string by passing in a second parameter env
:
var config = require('config-ninja').init('/path/to/cfg/dir/', 'staging');
Where env
is the name of your config file e.g. staging.config.json
.
You can also specify some options when instantiating Config-Ninja. All options are optional.
true
Set false if you want to your config filenames to be in the format of "development.json" instead of the default "development.config.json".Typically you will need 2 config files, one for production
and one for development
. You may also want config files for other enviroments such as staging
.
/myConfig
/production.config.json
/staging.config.json
/development.config.json
/custom.config.json
The enviroment string for a given config variable is stored under config._env
. Warning: If any of your config files contain a property called _env
this will overwrite config._env
.
Simply call config.init()
again without any parameters. Warning: If any of your config files contain a property called _cfgPath
this will break and you will need to specify the directory path again.
Call config.init(null, 'new-environment-string');
This will reload the config with the new environment.
No. That's beyond the scope of this module.
FAQs
Environmental JSON config.
The npm package config-ninja receives a total of 1 weekly downloads. As such, config-ninja popularity was classified as not popular.
We found that config-ninja 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
PyPI now supports digital attestations, enhancing security and trust by allowing package maintainers to verify the authenticity of Python packages.
Security News
GitHub removed 27 malicious pull requests attempting to inject harmful code across multiple open source repositories, in another round of low-effort attacks.
Security News
RubyGems.org has added a new "maintainer" role that allows for publishing new versions of gems. This new permission type is aimed at improving security for gem owners and the service overall.