myENA / consul-backinator

Command line Consul backup and restore utility supporting KVs, ACLs and Queries
Mozilla Public License 2.0
226 stars 22 forks source link

allow transform to match absolute key path from left to right #4

Closed vkhatri closed 8 years ago

vkhatri commented 8 years ago

Hi! This is relevant to #3

By default, transform matches oldkey anywhere in the consul kv.

It would be great to have another option or similar (e.g. -tranform-mode=absolute|regex) to perform an absolute left to right match on the kv.

e.g.

kv:
x/y/z/foo/x/y -> ignore
foo/x/y -> match

command:
-transform foo/x/y,foo/x/z -transform-mode=absolute
kv:
x/y/z/foo/x/y -> match
foo/x/y -> match

command:
-transform foo/x/y,foo/x/z -transform-mode=regex
aaronhurt commented 8 years ago

As I said in #3 the current path transformations are just string based and are not actually regex or path aware. I'll leave this open though and mark it as a possible future feature enhancement.

aaronhurt commented 8 years ago

Closing this issue. There isn't really a need for different transformation modes. If you want to perform a more restricted/absolute path transformation you should just be more explicit in what you pass to the transform option. The documentation has been updated to make this more explicit.