Skip to content

Use nested environment variables, literal JS like

Notifications You must be signed in to change notification settings

jarraga/env-literal

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

7 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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

About

Use nested environment variables, literal JS like

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published