@jarraga/env-literal
v1.0.3
Published
Use nested environment variables, literal JS like
Downloads
4
Maintainers
Readme
🪂 env-literal
Based on https://www.npmjs.com/package/dotenv-expand
This package iterates the variables of the process.env object, and parses them as if it were a literal javascript string, and injects them back into the same object
For example:
BASE_URL=http://localhost:3000
API=${BASE_URL}/api
In this case, the API variable will have the value http://localhost:3000/api
Unlike dotenv or dotenv-expand, variables are read directly from the system environment and not from an .env file
Usage: as soon as possible, run the function:
const envLiteral = require("@jarraga/env-literal");
if (process.env.NODE_ENV === "production") {
envLiteral(); // call envLiteral(true) for debugging
}