-
-
Notifications
You must be signed in to change notification settings - Fork 303
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add Base64 encode and decode methods #181
Comments
Hi @malisetti! Thanks for opening the issue. Could you give us a sample program showing some code that you'd like to write using this feature? |
@bitfield In my opinion this is very handy for sure- especialy in k8s ecosystem, where secrets are usually base64-encoded. bash with kubectl: kubectl get secret my-secret -o=jsonpath='{.data.myfield}' | base64 --decode It's not hard to image how that could be used in conjuction with secretField := script.Exec("kubectl get secret --output json --namespace XYZ some-secret").JQ(".data.myfield").Base64Decode().String() And vice versa- you might want to perform base64 encoding while setting some value. |
That sounds totally reasonable. But your example program: secretField := script.Exec("kubectl ...").JQ(".data.myfield").Base64Decode().String() doesn't actually match the API in #182, which is: func (p *Pipe) Base64Encode(enc *base64.Encoding) (string, error) { In other words, Also, in case we want to encode/decode other formats as well as base64, perhaps we should name the method It seems a shame to make users pass a What do you think about changing the PR to adopt an API something like this? func (p *Pipe) EncodeBase64() *Pipe { |
No description provided.
The text was updated successfully, but these errors were encountered: