spegel
spegel copied to clipboard
fix containerd config generation
This is proposal to fix https://github.com/spegel-org/spegel/issues/549. This is a bit complicated in my opinion but I couldn't figure out a better way. Except by writing a toml file without a toml lib which should be simpler and maybe preferable?
Map are output as toml table sorted by the key, which is not what we expect. This patch dynamically build a struct with a field for each host (and a toml tag). This allow us to control the order of hosts in the toml file as go-toml output struct as toml tables while preserving the order of the fields in the struct.