
Security News
Attackers Are Hunting High-Impact Node.js Maintainers in a Coordinated Social Engineering Campaign
Multiple high-impact npm maintainers confirm they have been targeted in the same social engineering campaign that compromised Axios.
parse-env makes it easy to make your project support environment variable based configuration. It infers the environment variable names based on the given template. That template may be the configuration itself. Should an environment variable matching to the convention be found, it will use that rather than the one in the original configuration.
To make the way it works clearer, consider the example below. It consists of three files. The first one is a template which you would store at your repository. The second one is a private configuration not stored for security reasons. The third one deals with parsing. The files are inside a config package. The last file works as an entry point to it.
config/config.template.js:
module.exports = {
port: 8000,
aws: {
accessKeyId: 'replacethis',
secretAccessKey: 'replacethis'
}
};
config/config.js:
module.exports = {
port: 80,
aws: {
accessKeyId: 'actualid',
secretAccessKey: 'actualkey'
}
};
config/index.js:
var parseEnv = require('parse-env');
var tpl = require('./config.template');
// the configuration file is optional and doesn't have to exist
var conf;
try {
conf = require('./config');
}
catch(e) {}
module.exports = parseEnv(process.env, tpl, conf);
The parser is convention based. It performs the following conversions:
In case no match is found either in the environment or configuration, it will just skip the value. If you want to enable warnings, set VERBOSE_PARSE_ENV as a truish value.
parse-env is available under MIT. See LICENSE for more details.
FAQs
Parses configuration from env
The npm package parse-env receives a total of 13 weekly downloads. As such, parse-env popularity was classified as not popular.
We found that parse-env 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
Multiple high-impact npm maintainers confirm they have been targeted in the same social engineering campaign that compromised Axios.

Security News
Axios compromise traced to social engineering, showing how attacks on maintainers can bypass controls and expose the broader software supply chain.

Security News
Node.js has paused its bug bounty program after funding ended, removing payouts for vulnerability reports but keeping its security process unchanged.