-
Notifications
You must be signed in to change notification settings - Fork 407
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
Won't read from variable when it contains $ character #52
Comments
I have the same exact issue It has to do with this function being used which looks like it's meant to replace environment settings but it replaces dollar signs.
|
@dkeza I changed over to this project and it works correctly (plus it's active this one seems dead) |
Hi there, sorry I hadn't replied. Project's not dead, I'm just going through a very hectic phase of life right now. I will look into this, I'm suspecting a regression in some of the more recent updates to variable substitution. |
@joho no worries, it's understandable. |
Couple of notes - os.Expand does not supports escaping (so no workarround for this issue); |
…eave the key as it was. joho#52
There's definitely a bug here, maybe more than one, but not the one I think people are trying to fix. One goal of the library (that the library is frequently falling short of) is to have cross compatibility with the rails and node dotenv file formats. So to decide what the right fix is I went and tested the same config against the ruby version https://gist.github.com/joho/e5ce5415f75feac3c7dedc8ea38611cb So the expansion in the Go version is definitely wrong, but #57 makes it wronger. |
Lol ok, then I guess I'll stick to my fork that allows my passwords to have $'s in them. I don't know anything about the Ruby dotenv but the node dotenv package actually doesn't do variable expansion at all: https://www.npmjs.com/package/dotenv#what-about-variable-expansion |
https://github.com/bkeepers/dotenv/blob/master/spec/dotenv/parser_spec.rb#L49-L77 The ruby version is the original, spun out of heroku who popularised the 12 factor approach (for better or worse), and this and the node version are both clones, so I treat ruby as canonical. The bug that does need to be fixed and will allow you to have dollar signs in passwords is that |
Ah, as @egorse points out I guess to get escaping working properly I'll need my own expansion logic. |
…Expand Copy over the tests from https://github.com/bkeepers/dotenv/blob/master/spec/dotenv/parser_spec.rb related to expanding variables and implement the required changes. I also realized as part of this that this implementation was not handling values in single quotes properly (e.g.: not the same was as the ruby package mentionned) so that has been fixed as well along with the related tests. Fixes: joho#52
go version go1.9.2 windows/386
When I am reading from variable in my .env file which has $ in string:
MAIL_SECRET=xTvDqw$27
os.Getenv("MAIL_SECRET")
gives xTvDqw7 back, ignoring $2
why is that, have $ sign some special meaning?
The text was updated successfully, but these errors were encountered: