realestate-com-au / shush

It's a secret.
169 stars 36 forks source link

Allow multiple --context command-line arguments to be specified #3

Closed spjwebster closed 7 years ago

spjwebster commented 7 years ago

AWS supports multiple KEY=VALUE pairs in the KMS encryption context, so shush should either support multiple --context arguments (implemented here) or support a separator for multiple KEY=VALUE pairs within the single --context arg.

This PR also changes the parsing of --context to allow additional = characters in the value portion of the string by splitting at the first = only. I don't actually have a usecase here but it seems safer than the previous implementation that silently threw away =blah in foo=bar=blah.

mdub commented 7 years ago

Nice work, thanks! I wasn't aware of the "StringSlice" option type.

Good pickup on the Split bug, too.

What happens with "StringSlice" flags and environment variables? More specifically, do we get support for specifying multiple KEY=VAL pairs via $KMS_ENCRYPTION_CONTEXT?

spjwebster commented 7 years ago

Thanks for merging. The urfave/cli docs weren't clear on this, but checking the code environment variables support multiple key/value pairs separated by a comma, so KMS_ENCRYPTION_CONTEXT=foo=bar,baz=blah shush ... is the same as shush -C foo=bar -C baz=blah ....

mdub commented 7 years ago

That's a good outcome, then. Thanks for checking.