Closed atljoseph closed 9 months ago
I second that request.
My use case is that I'd like to use the .env
files to hold defaults for my env vars, and they have the same name externally as internally to reduce confusion.
So even if the CI sets a env var named MY_VAR to an empty string, the .env default value defined like MY_VAR=${MY_VAR:-DEFAULT}
will be respected.
And in the app I don't have to care the source of value, just rely on MY_VAR
This seems to be a breaking change with a newer version 2020, too. I guess this part was never tested explicitly before.Sent from my iPhoneOn Apr 18, 2023, at 9:22 AM, Leandro Boscariol @.***> wrote: I second that request. My use case is that I'd like to use the .env files to hold defaults for my env vars, and they have the same name externally as internally to reduce confusion. So even if the CI sets a env var named MY_VAR to an empty string, the .env default value defined like MY_VAR=${MY_VAR:-DEFAULT} will be respected. And in the app I don't have to care the source of value, just rely on MY_VAR
—Reply to this email directly, view it on GitHub, or unsubscribe.You are receiving this because you authored the thread.Message ID: @.***>
+1 on this request
I stumbled on that issue as I was trying to set a default variable if it ever was not available. For example, I was willing to set the $GID variable if it was not available:
GID="${GID:-${GROUPS:-$UID}}"
Let's admit that my case is a bit overcomplicated and only use the following:
GID="${GID:-$UID}"
I would still get the same error, while it is completely missing the point of the syntax, that is a valid one. I might not expect the substitution to work well in that specific case, but neither would I expect it to crash that badly either.
Thanks for your time maintaining this awesome package :smile:
No updates about this issue?
same issue here
same issue too.
looking into this soon. thank you for your patience everyone. know it is frustrating. lots to keep up on!
this is fixed in v11.0.0
(releasing shortly)
here is test demonstrating it is fixed: https://github.com/motdotla/dotenv-expand/pull/111
any recursive call like this will now end up just returning the raw value it was set to.
When I have a
.env
file like this, everything works fine:But this breaks:
This line causes the breakage:
Somehow the library cannot handle this situation.
Error produced:
Someone has already faced this issue and documented it somewhat: https://stackoverflow.com/questions/49287598/maximum-call-stack-size-exceeded-from-dotenv-expand-on-circleci-using-react
You might ask the question: Why?
Using these versions: