
Product
Socket Now Protects the Chrome Extension Ecosystem
Socket is launching experimental protection for Chrome extensions, scanning for malware and risky permissions to prevent silent supply chain attacks.
dotenv-json-complex
Advanced tools
Load complex enviroment variable via JSON file
With Nodejs installed run the installation command in a terminal:
npm install dotenv-json-complex
Create a .env.json
file in the root of your project:
{
"my_app_env": {
"nodeEnv": "development",
"api": {
"prefix": "/api"
},
"database": {
"username": "foo",
"password": "bar",
"name": "awesome_db_name",
"host": "my_db_host"
}
}
}
After that, load your environment variables by requiring the dotenv dotenv-json-complex and executing it:
// here you load the json to your process.env
require("dotenv-json-complex")();
const env = JSON.parse(process.env.my_app_env);
// this will print your complex json environment!
console.log(env)
// like this
{
"nodeEnv": "development",
"api": {
"prefix": "/api"
},
"database": {
"username": "foo",
"password": "bar",
"name": "awesome_db_name",
"host": "my_db_host"
}
}
Furthermore you can provide an object to change environment filename:
require("dotenv-json-complex")({ environment: 'qa' });
This will look for .env.qa.json
file and load it in memory.
Pull requests are welcome. For major changes, please open an issue first to discuss what you would like to change.
FAQs
Load complex enviroment variable via JSON file
The npm package dotenv-json-complex receives a total of 535 weekly downloads. As such, dotenv-json-complex popularity was classified as not popular.
We found that dotenv-json-complex 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.
Product
Socket is launching experimental protection for Chrome extensions, scanning for malware and risky permissions to prevent silent supply chain attacks.
Product
Add secure dependency scanning to Claude Desktop with Socket MCP, a one-click extension that keeps your coding conversations safe from malicious packages.
Product
Socket now supports Scala and Kotlin, bringing AI-powered threat detection to JVM projects with easy manifest generation and fast, accurate scans.