motdotla / dotenv-expand

Variable expansion for dotenv. Expand variables already on your machine for use in your .env file.
https://dotenvx.com
BSD 2-Clause "Simplified" License
953 stars 95 forks source link

Strange handling $ONE$TWO #103

Closed oturpe closed 8 months ago

oturpe commented 1 year ago

Consider the following env file:

NO_NO="NO_NO: $NO$NO"
YES_NO="YES_NO: $YES$NO"
YES_YES="YES_YES: $YES$YES"
NO_YES="NO_YES: $NO$YES"
YES_YESS="YES_YESS: $YES$YESS"

When NO is not defined and YES and YESS are defined, this results in:

NO_NO: 
YES_NO: yes
YES_YES: yesyes
NO_YES: 
YES_YESS:

In other words, if ONE and TWO are both defined, $ONE$TWO evaluates to undefined. This is highly unintuitive. I expect both variables to be expanded in this case.

As a workaround, ${ONE}${TWO} works as expected.

Version: 10.0.0

This used to work with 5.1.0.

motdotla commented 9 months ago

showing failing spec here: https://github.com/motdotla/dotenv-expand/pull/108

motdotla commented 8 months ago

fixed here. will go out as part of v11.0.0 (should be released today or tomorrow) https://github.com/motdotla/dotenv-expand/pull/108

oturpe commented 8 months ago

Nice, thanks!