@jarraga/env-literal

1.0.3 • Public • Published

🪂 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
}

Package Sidebar

Install

npm i @jarraga/env-literal

Weekly Downloads

0

Version

1.0.3

License

ISC

Unpacked Size

2.81 kB

Total Files

3

Last publish

Collaborators

  • jarraga