cue icon indicating copy to clipboard operation
cue copied to clipboard

encoding: ini support

Open uhthomas opened this issue 2 years ago • 2 comments

Is your feature request related to a problem? Please describe.

Some applications, like Grafana, use ini files for configuration.

Describe the solution you'd like

It would be nice to have a new encoding/ini package for marshalling cue to ini.

Describe alternatives you've considered

Additional context

The Grafana configuration in a Kubernetes config map is just plain text. The configuration could be represented with cue and encoded to ini.

https://github.com/uhthomas/automata/blob/92de44958bb7c7ac91ad693a09febffeeebd021c/k8s/unwind/grafana/config_map_list.cue#L43-L68

uhthomas avatar Nov 10 '23 12:11 uhthomas

Not a duplicate of https://github.com/cue-lang/cue/issues/1621 at all, but worth noting that they are both similar plaintext key-value config formats.

mvdan avatar Nov 10 '23 12:11 mvdan

Also worth noting that with @myitcv we recently talked about writing a "gitconfig" encoder, even if it's not part of the main cuelang.org/go Go module, to implement the ini-like format documented at https://git-scm.com/docs/git-config. It is used elsewhere besides just Git, like for example Gerrit's https://gerrit-review.googlesource.com/Documentation/config-project-config.html, which we need to maintain due to our use of GerritHub, and we'd like to export from CUE.

So perhaps the two encoders could share some code as well, given their similarity. Or perhaps using existing Go packages for ini and gitconfig formats separately would be better, it depends on what is out there.

mvdan avatar Nov 10 '23 13:11 mvdan