Keys deleted from .env.example when not in .env
laendoor opened this issue · comments
Hi @codeshifu , I have this problem.
Sometimes I keep some keys in .env.example
for documentation but not in .env
because I use defaults or something.
So, if you have keys in .env.example
but not in .env
, when you sync they are deleted from .env.example
.
Example
.env
:
BOTH=1
ENV=0
.env.example
:
BOTH=2
EXAMPLE=42
ANOTHER=24
ENV=3
run sync-dotenv
then
.env.example
:
BOTH=2
ENV=3
The keys EXAMPLE
and ANOTHER
were deleted.
Thanks
Will look into this as well. Thanks for reporting
Hi @leandrojdl, this has been resolved in v2.5.0 release. See the docs for usage https://github.com/codeshifu/sync-dotenv#preserving-variables-in-sample-env
@leandrojdl There was a problem with the release build of the library in v2.5.0 using [microbundle][https://www.npmjs.com/package/microbundle) as reported here #28.
This has been fixed. Please consider using the patch at v2.5.1 or using the latest version
Hi @codeshifu
I just tried it with version v2.6.0 and it's still happening.
Did you follow the guide here? https://github.com/codeshifu/sync-dotenv#preserving-variables-in-sample-env
Yes, I add that configuration first, but it's still deleting keys in .env.example
Hey @leandrojdl, I just tried on my end and it seems to be working fine. If you don't mind, I'll like to see a reproducible example
Sorry, I tried again while I was writing a reproducible example and now it's not happening. I don't know why. Maybe npm cache.
So, it's OK, now it's works.
Thanks