motdotla / dotenv-expand

Variable expansion for dotenv. Expand variables already on your machine for use in your .env file.

Home Page:https://dotenvx.com

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Can this be used on existing env variables on the system (not via .env)

NaikAayush opened this issue · comments

The project description mentions "If you find yourself needing to expand environment variables already existing on your machine, then dotenv-expand is your tool."

And after my exploration it seems like it's not for already existing environment variables. Raising this issue for confirmation on the same, is the description supposed to be "If you find yourself needing to expand environment variables already existing on your machine, then dotenv-expand is NOT your tool."?

Or is there a way to use this for already existing environment variables.

I think this would work.

 expand({ ignoreProcessEnv: true, parsed: process.env })
commented

yes, you can do what @ivandotv detailed.

also, keep an eye on dotenvx. we are adding variable expansion to it soon dotenvx/dotenvx#58. then you can wrap any server or command with dotenv. handy.