tweag / nickel

Better configuration for less
https://nickel-lang.org/
MIT License
2.25k stars 84 forks source link

base64 encoding in stdlib #1654

Open gkleen opened 9 months ago

gkleen commented 9 months ago

In #1498 I need to base64 encode some values for inclusion into a kubernetes secret.

Currently I'm doing that with the coreutils base64 command at nix eval time.

I would prefer to express the fact that values get base64 encoded directly in the nickel template.
For that a function in std to base64 encode a string would be ideal.

It would be great if the entire space of possibilities (standard charset, urlsafe charset, padded, unpadded) was available for future purposes.

yannham commented 9 months ago

That's a fair demand and probably cheap to implement. We'd make that a primop relying on a Rust implementation under the hood, for performance reason.

yannham commented 9 months ago

By the way, both your feature requests are arguably beginner-friendly. If you would like to try to tackle them by yourself, I would be happy to provide guidance and review.

gkleen commented 9 months ago

By the way, both your feature requests are arguably beginner-friendly. If you would like to try to tackle them by yourself, I would be happy to provide guidance and review.

I would certainly be open to giving it a shot but it'll be quite some time until I will likely be able to get around to working on it.
The dayjob and freelancing is keeping me quite busy :/

silverraven691 commented 9 months ago

Unrelated to your request but for what it's worth, Secret has a write-only stringData field that gets merged into data by the API server https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.26/#secret-v1-core