myENA / consul-backinator

Command line Consul backup and restore utility supporting KVs, ACLs and Queries

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Dump readable values to stdout

matschaffer opened this issue · comments

I noticed that the -dump option provides values as base64 encoded.

Would be possible/preferable to display them as straight strings in the dump output?

The -dump option simply returns the raw decrypted/decompressed output from the Consul API. It is just an easy way to "view" your backup files.

-- Aaron

On Mar 6, 2016, at 10:10 PM, Mat Schaffer notifications@github.com wrote:

I noticed that the -dump option provides values as base64 encoded.

Would be possible/preferable to display them as straight strings in the dump output?


Reply to this email directly or view it on GitHub.

For sure. My thinking was that if we had multiple backup files it could be useful to see the full set of keys & values to confirm we're reloading the best possible backup. For the time being I came up with this:

> consul-backinator -restore -dump |\
  jq -r '.[] | [.Key, .Value] | @sh' |\
  xargs -I{} -n1 sh -c 'echo $(echo {} | cut -d" " -f1)=$(echo {} | cut -d" " -f2 | base64 -d)'

But it's pretty roundabout compared with what I'm guessing it'd take to have the dump code show decoded values.

Maybe -dump -decode would be better?

Got it. So instead of just decoding would you actually prefer a "human readable" output? Maybe something in ascii table format?

Something like this ... https://github.com/olekukonko/tablewriter

That sounds like a cool idea. I haven't put much time into brainstorming
formats but so long as it's diffable it should be good.

On Tuesday, 8 March 2016, Aaron Hurt notifications@github.com wrote:

Got it. So instead of just decoding would you actually prefer a "human
readable" output? Maybe something in ascii table format?


Reply to this email directly or view it on GitHub
#1 (comment)
.

-Mat

matschaffer.com

I couldn't think of a nice way to use a table or other format with all the possible options for a data payload in a KV store. I settled on just a very simple output format ...

Key: keyName
ValueHere and Here
and Here
Key: someOtherKey
more Values and Stuff

This should be greppable/diffable and give you approximately what you wanted.

Looks fantastic. Thanks!