-
Notifications
You must be signed in to change notification settings - Fork 49
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Variable Expansion Divergence #73
Comments
Issues also arise when using the same syntax for a
Both |
An alternative crate It may be a viable replacement to consider in the meantime? |
@allan2 Would you like to flag this behavior as intended? If not, I can go ahead and create a draft PR (or maybe a full PR) implementing a fix for this. |
Howdy. I recently opened up moonrepo/moon#760 which is a project using
dotenvy
.I wanted to raise a situation that we ran across with variable expansion and the need for curly brackets in order for
dotenvy
to parse successfully. In the past, we've used an.env
file that looks like this:This works really well with both
source .env
(via shell) as well as parsers like the Node-standard https://github.com/motdotla/dotenv. Kudos fordotenvy
also supportingexport
by the way. Recently we used a similar file with moon, which uses this project for its.env
file needs, and were getting some unexpected results. The value for$DEPLOY_ENV
was;source
:dev
dotenv
:dev
dotenvy
:_ENV
The moon devs pointed out that we might have to use curly brackets, changing the file to:
And that worked fine, with
dotenvy
returningdev
as expected. Here's where I thinkdotenvy
diverges from the spec:echo $SHELL
is a parameter expansion, and parameters can contain underscores (https://www.gnu.org/software/bash/manual/html_node/Bash-Variables.html), so substituting and empty string for the$DEPLOY
portion of$DEPLOY_ENV
is likely a bug. Curly brackets are only necessary for positional expansion or when the character that follows isn't a part of the variable/parameter name (https://tldp.org/LDP/Bash-Beginners-Guide/html/sect_03_04.html) so it looks like there's a possible bug in the implementation around that indotenvy
as well.The text was updated successfully, but these errors were encountered: