For .env, we use the following pattern:
export KEY="value" # comment
Actual behavior after we parse such file:
>>> os.getenv('KEY')
'"value" # comment'
Expected behavior:
>>> os.getenv('KEY')
'value'
The tricky part here is that # can be contained within the quoted value (e.g. KEY="#"), so we can't ignore everything after the #.
What is worse, bash requires # to be at the beginning of the token, so something like this is valid:
bash$ KEY=#value
bash$ echo $KEY
#value
Ruby dotenv works fine with trailing comments, but it uses a complicated regular expression to do that.
For
.env, we use the following pattern:Actual behavior after we parse such file:
Expected behavior:
The tricky part here is that
#can be contained within the quoted value (e.g.KEY="#"), so we can't ignore everything after the#.What is worse,
bashrequires#to be at the beginning of the token, so something like this is valid:Ruby dotenv works fine with trailing comments, but it uses a complicated regular expression to do that.