-
Notifications
You must be signed in to change notification settings - Fork 38
Open
Description
Issue
We have no way to know if we are going to overwrite local or remote changes when pushing or pulling from the vault. This is annoying when teammates forget to check for changes before syncing. I am not yet a regular user, I'm beginning to use the project, so I may be wrong. Please correct me if it is so.
Solution
Logic
dotenv-vault pull
- Get the last local update date
- Get the last remote update date
- Throw an error on pull if
last_local_update>last_remote_update
⇒ this means changes occurred locally between our last pull from the repo and our local edits.
dotenv-vault push
- Get the last remote update date
- Get the penultimate local update date
- Throw an error on push if
last_remote_update>penultimate_local_update
⇒ this means changes occurred on the remote between our last push to the repo and our local edits.
Modification to the CLI
You could either provide:
- A new
check-conflictscommand. This would display if there is a discrepancy between the remote and the local changes, exit with error if there is, else exit successfully so that we can use it in scripts. This would not break default behaviour. - A new
--check-conflictsflag todotenv-vault pushanddotenv-vault pullto exit with an error when pulling/pushing if changes were detected. This would not break default behaviour. - A new
--ignore-conflictsflag todotenv-vault pushanddotenv-vault pullto ignore conflicts when pulling/pushing and override local state. This would break default behaviour, the new default would check for conflicts. I think this should be the default anyway, we should ask for input to be sure the user wants to override.
Metadata
Metadata
Assignees
Labels
No labels