Crates.io | ub64m |
lib.rs | ub64m |
version | 1.1.0 |
source | src |
created_at | 2023-10-15 18:43:01.713811 |
updated_at | 2023-10-15 23:55:04.26853 |
description | A cli tool for decoding base64 values in JSON and YAML |
homepage | |
repository | https://github.com/elmiko/ub64m |
max_upload_size | |
id | 1004071 |
size | 18,211 |
A tool to help me with kubernetes manifest wrangling. There is probably a simpler/more elegant way to do this using standard cli tools, but where's the fun in that? 😂
This tool will take a JSON or YAML document and decode all base64 encoded strings in the values for any field. It will then print the output as a new YAML file.
$ cat tests/data/encoded-sample.yaml
---
Name: Cloud Configuration
Version: 1
Private: true
Account:
User: Qm9iCg==
Zones:
- ZWFzdC0xLWEK
- ZWFzdC0xLWIK
- c291dGgtMi1hCg==
ProjectName: Ym9icy1iaWctcHJvamVjdAo=
Token: c3VwZXItc2VjcmV0Cg==
$ ./target/debug/ub64m tests/data/encoded-sample.yaml
---
Name: Cloud Configuration
Version: 1
Private: true
Account:
User: Bob
Zones:
- east-1-a
- east-1-b
- south-2-a
ProjectName: bobs-big-project
Token: super-secret
$ kubectl create -f tests/data/kubernetes-configmap.yaml
$ kubectl get cm cloud-config -o yaml
apiVersion: v1
data:
projectName: Ym9icy1iaWctcHJvamVjdAo=
token: c3VwZXItc2VjcmV0Cg==
user: Qm9iCg==
kind: ConfigMap
metadata:
creationTimestamp: "2023-10-15T23:50:15Z"
name: cloud-config
namespace: default
resourceVersion: "1776"
uid: 7aeee832-4421-472e-a27d-83b4dece0c7f
[mike@gamebox] devel ~/dev/ub64m
$ kubectl get cm cloud-config -o yaml | ./target/debug/ub64m -
---
apiVersion: v1
data:
projectName: bobs-big-project
token: super-secret
user: Bob
kind: ConfigMap
metadata:
creationTimestamp: "2023-10-15T23:50:15Z"
name: cloud-config
namespace: default
resourceVersion: "1776"
uid: 7aeee832-4421-472e-a27d-83b4dece0c7f
From $HOME
in your terminal type the following:
cargo install ub64m
This will install the ub64m
binary to the .cargo/bin
directory, please
note that this will need to be in your $PATH
for easier use.