lewispeckover / consulator

Import and synchronize your Consul KV data from JSON and YAML
MIT License
32 stars 13 forks source link

Optional purge / delete #2

Closed prein closed 7 years ago

prein commented 7 years ago

I've just started playing with the tool and noticed that all the previously existing keys got purged from Consul prior to importing. I found out that if I specify -prefix then it will delete only inside that path which helps, but I can still imagine scenario when I have >1 source of data writing to the same path and I would prefer the keys to not to be purged.
Would you consider making delete (purge) optional, so that one would have to add, say -delete option?

lewispeckover commented 7 years ago

Hmm, I'll try and make it clearer that 'import' it removes things by default. It is intended to sync a tree. Perhaps I should have named it 'sync'. 😄

For your use case, you could use consul kv import (consul >=0.7.3) to achieve a non-destructive import. consulator dump /etc/consul | consul kv import -

But I do think it's a good idea, I'll add a switch for that shortly.