dotenv-vault icon indicating copy to clipboard operation
dotenv-vault copied to clipboard

Add settings to .env.vault to customize things like .gitignore

Open www-chique opened this issue 2 years ago • 3 comments

The problem

dotenv-vault pull and dotenv-vault push modifying my gitignore file every time.

Proposal

Removing the following checks on pull and push

    new AppendToDockerignoreService().run()
    new AppendToGitignoreService().run()
    new AppendToNpmignoreService().run()

Little explanation

I have noticed that during all the commands (pull, push, etc), it checks .gitignore (and also .npmignore, .dockerignore) for existence of the ".env", "!.env.vault", etc., and modifies the gitignore file if it doesn't adhere to the specific gitignore lines it's looking for. It makes total sense when creating a new / linking an existing project, but not on every pull and push.

Why? / My use case

As mentioned in #228 , a use case exists where I would like to not commit the .env.vault / .env.project into the repository, so I had to manually change these gitignores automatically added by dotenv-vault. What this means is, I manually and intentionally removed the !.env.vault and !.env.project from my gitignore. But on every pull and push, they are added again, which is not what I want.

Please note: I am totally fine with the code automatically adding these git-ignores during new or build. I just don't want it to modify the file again during a dotenv-vault pull or push and alter my own git-ignore modifications.

P.S. Big fan of dotenv-vault!

www-chique avatar Jan 25 '23 22:01 www-chique

@www-chique good point. That is annoying. I don't like when software gets in the way.

I think we will adjust to your suggestion - just on new and build (with the ability to force ignore). Let me think on that.

One thing we have also kicked around is using the .env.vault itself as instructions for these commands - that the dotenv-vault cli would obey. Basically mapping default flags to flags inside of the .env.vault file.

This way each individual could create their project with their chosen settings - gitignore append always on, bypass open ui prompt always on, etc.

motdotla avatar Jan 28 '23 01:01 motdotla

@motdotla - That sounds amazing! Since you already added it to the roadmap at #238 , you can close this thread if you like. Since that will solve my problem.

www-chique avatar Jan 30 '23 17:01 www-chique