-
-
Notifications
You must be signed in to change notification settings - Fork 7
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
Consider supporting VAR="with space and $substitution" in .env
#166
Comments
@huonw presumably you've read through the dotenvy issue; so you realize you're asking scie jump to roll it's own internally or else create a new .env handling crate. The root issue here is that .env is not standardized, but it is prevalent. You're fully aware of the xkcd-worthy traps of either path. Did you have a choice in mind? |
Yes, I'm aware that the reality of actually improving this particular feature may make it not worth it (or, maybe just left for some motivated contributor to improve dotenvy first). In any case, In terms of alternatives, https://github.com/arniu/dotenvs-rs seems to be a little more explicit about what syntax it accepts... but hits arniu/dotenvs-rs#4 (i.e. #163 again, which is more important than this one) so... 🤷♂️ Thus, I have no concrete path forward other than either roll-ones-own (bleh), or improving |
Ok, thanks for a fuller picture of the request. To complete the picture, afaict the motivating use case is a script that generates a Further, the |
Documenting the supported |
This fixes #20127 by avoiding double quotes in the `.env` file generated by the code snippet in the IDE set-up docs. Double quotes aren't supported by the `scie-pants` `.env` loader, and a line containing them was previously silently ignored (plus all lines after), but with scie-pants 0.11.0, will be an error. See pantsbuild/scie-pants#307 and pantsbuild/scie-pants#319. The new suggestion has _no_ quotes at all, because there's no other way to have a line that includes a substitution. To handle source roots with spaces in their paths, this has to also manually escape them. Supporting double quotes is effectively a new feature of `scie-pants` launcher (via scie jump a-scie/jump#166 via `dotenvy` allan2/dotenvy#11), but for now we can at least stop suggesting incorrect things. For instance, with source roots `a b/c` and `def`, this generates: ``` PYTHONPATH=./a\ b/c:./def:$PYTHONPATH ```
This fixes #20127 by avoiding double quotes in the `.env` file generated by the code snippet in the IDE set-up docs. Double quotes aren't supported by the `scie-pants` `.env` loader, and a line containing them was previously silently ignored (plus all lines after), but with scie-pants 0.11.0, will be an error. See pantsbuild/scie-pants#307 and pantsbuild/scie-pants#319. The new suggestion has _no_ quotes at all, because there's no other way to have a line that includes a substitution. To handle source roots with spaces in their paths, this has to also manually escape them. Supporting double quotes is effectively a new feature of `scie-pants` launcher (via scie jump a-scie/jump#166 via `dotenvy` allan2/dotenvy#11), but for now we can at least stop suggesting incorrect things. For instance, with source roots `a b/c` and `def`, this generates: ``` PYTHONPATH=./a\ b/c:./def:$PYTHONPATH ```
This fixes #20127 by avoiding double quotes in the `.env` file generated by the code snippet in the IDE set-up docs. Double quotes aren't supported by the `scie-pants` `.env` loader, and a line containing them was previously silently ignored (plus all lines after), but with scie-pants 0.11.0, will be an error. See pantsbuild/scie-pants#307 and pantsbuild/scie-pants#319. The new suggestion has _no_ quotes at all, because there's no other way to have a line that includes a substitution. To handle source roots with spaces in their paths, this has to also manually escape them. Supporting double quotes is effectively a new feature of `scie-pants` launcher (via scie jump a-scie/jump#166 via `dotenvy` allan2/dotenvy#11), but for now we can at least stop suggesting incorrect things. For instance, with source roots `a b/c` and `def`, this generates: ``` PYTHONPATH=./a\ b/c:./def:$PYTHONPATH ```
…20146) This fixes #20127 by avoiding double quotes in the `.env` file generated by the code snippet in the IDE set-up docs. Double quotes aren't supported by the `scie-pants` `.env` loader, and a line containing them was previously silently ignored (plus all lines after), but with scie-pants 0.11.0, will be an error. See pantsbuild/scie-pants#307 and pantsbuild/scie-pants#319. The new suggestion has _no_ quotes at all, because there's no other way to have a line that includes a substitution. To handle source roots with spaces in their paths, this has to also manually escape them. Supporting double quotes is effectively a new feature of `scie-pants` launcher (via scie jump a-scie/jump#166 via `dotenvy` allan2/dotenvy#11), but for now we can at least stop suggesting incorrect things. For instance, with source roots `a b/c` and `def`, this generates: ``` PYTHONPATH=./a\ b/c:./def:$PYTHONPATH ``` Co-authored-by: Huon Wilson <[email protected]>
…20145) This fixes #20127 by avoiding double quotes in the `.env` file generated by the code snippet in the IDE set-up docs. Double quotes aren't supported by the `scie-pants` `.env` loader, and a line containing them was previously silently ignored (plus all lines after), but with scie-pants 0.11.0, will be an error. See pantsbuild/scie-pants#307 and pantsbuild/scie-pants#319. The new suggestion has _no_ quotes at all, because there's no other way to have a line that includes a substitution. To handle source roots with spaces in their paths, this has to also manually escape them. Supporting double quotes is effectively a new feature of `scie-pants` launcher (via scie jump a-scie/jump#166 via `dotenvy` allan2/dotenvy#11), but for now we can at least stop suggesting incorrect things. For instance, with source roots `a b/c` and `def`, this generates: ``` PYTHONPATH=./a\ b/c:./def:$PYTHONPATH ``` Co-authored-by: Huon Wilson <[email protected]>
Alright - dotenvs-rs LGTM; I gave it a go: arniu/dotenvs-rs#5 - we'll see if that gets accepted. |
You won't get item 4 ( |
Switch from the dotenvy crate to dotenvs to achieve this. A patched version is used to ensure we maintain support for hard failure when invalid `.env` files are read. Fixes a-scie#166 Fixes a-scie#167
Switch from the dotenvy crate to dotenvs to achieve this. A patched version is used to ensure we maintain support for hard failure when invalid `.env` files are read. Fixes a-scie#166 Fixes a-scie#167
Continuing #163, it seems that double quotes aren't supported, so it is inconvenient to use
.env
to set a variable that has both a space in it and does a$
env var substitution, because all the spaces have to be individually\
escaped.In particular, it'd be nice to have this table have 4 ✅:
.env
lineA="x $y"
A=x\ $y
\
sA='x $y'
A=x $y
This is effectively a limitation of
dotenvy
, e.g. allan2/dotenvy#11. I don't know if another library has different behaviour.The text was updated successfully, but these errors were encountered: