motdotla / dotenv

Loads environment variables from .env for nodejs projects.
https://www.dotenvx.com
BSD 2-Clause "Simplified" License
19.17k stars 862 forks source link

Variable expansion (reference) should work without an additional package #694

Open MiguelMike opened 1 year ago

MiguelMike commented 1 year ago

Let's assume we have an .env file:

FIRST_NAME="Joe"
SURNAME="Doe"
FULL_NAME="${FIRST_NAME} ${SURNAME}"

After this file is sourced $FULL_NAME would automatically have the referenced variables filled. That's what one would expect more often than not. This is not the case when using dotenv. To achieve this an additional package dotenv-expand is required.

It would make much more sense if dotenv expanded referenced variables by default. A config option {expand: false} might be used to change this behavior. Am I missing something?

motdotla commented 1 year ago

You have a good point. Will consider this.

deepam-kapur commented 1 year ago

can I work on this @motdotla?