
Security News
Axios Maintainer Confirms Social Engineering Attack Behind npm Compromise
Axios compromise traced to social engineering, showing how attacks on maintainers can bypass controls and expose the broader software supply chain.
env-config-example
Advanced tools
Simple app to illustrate how to handle environment variables and config in Node.js
The goals of this package are:
With npm:
npm install env-config-2 --save
With yarn:
yarn add env-config-2
# File: config.js
const envConfig = require('env-config-2')
const {NODE_ENV} = process.env
const defaultConfig ={
NODE_ENV,
PORT: (NODE_ENV === 'development' ? 3000 : null),
MONGODB_URL: `mongodb://localhost:27017/node_env_config_example_${NODE_ENV}`,
JWT_SECRET: (NODE_ENV === 'development' ? 'foobar' : null),
JWT_EXPIRY: (3600 * 24 * 30),
RATE_LIMIT: (NODE_ENV === 'production' ? 5 : null),
ALGOLIASEARCH_APPLICATION_ID: null,
ALGOLIASEARCH_API_KEY: null,
ALGOLIASEARCH_API_KEY_SEARCH: null,
API_BASE_URL: (NODE_ENV === 'development' ? 'http://localhost:3000/v1' : 'https://api.versioned.io/v1')
}
module.exports = envConfig.generateConfig(defaultConfig)
# File: index.js
const http = require('http')
const config = require('config')
function handler (request, response) {
response.writeHead(200, {'Content-Type': 'text/plain'})
response.end('Hello World')
}
const server = http.createServer(handler).listen(config.PORT)
console.log('Server started with config:', config)
FAQs
Simple app to illustrate how to handle environment variables and config in Node.js
We found that env-config-example 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
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.

Security News
The Axios compromise shows how time-dependent dependency resolution makes exposure harder to detect and contain.