question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Keys deleted from .env.example when not in .env

See original GitHub issue

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

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:8 (5 by maintainers)

github_iconTop GitHub Comments

1reaction
laendoorcommented, Apr 7, 2020

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

1reaction
codeshifucommented, Mar 29, 2020

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

Read more comments on GitHub >

github_iconTop Results From Across the Web

Go Ahead, Delete Your .env.example File - 1Password Blog
We specify instructions on how to set up your own local environment in a .env.example file or README.md file. For every project that...
Read more >
Removing a .env file from Git history - Daily Dev Tips
You can remove a file from Git by running the following command. git rm -r --cached .env. If we then push this change,...
Read more >
What is the need for env and env.example files in Laravel?
env is simply used to store all sensitive files like password API key, database,and so on as environment variables to be used in...
Read more >
How to use Laravel .env and .env.example files?
In your main Laravel folder you should have .env file which contains various settings, one row – one KEY=VALUE pair. And then, within...
Read more >
Should I add .env to .gitignore? - Sal Ferrarello
example file. This file contains the same structure as your .env file but all of the credentials and API keys have been removed....
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found