by jaxxstorm on 5/16/22, 5:31 AM with 140 comments
by keithnz on 5/16/22, 6:10 AM
by einherjae on 5/16/22, 6:11 AM
by karlicoss on 5/16/22, 8:47 AM
Shameless plug if you wanna read a longer analysis: https://beepb00p.xyz/configs-suck.html
A great example is pyinfra https://github.com/Fizzadar/pyinfra#readme Think Ansible but instead of YAML you write Python. It provides a set of primitives/DSL and some rules you need to adhere to, but otherwise you just write regular python code.
by blagie on 5/16/22, 3:50 PM
There are a few keys:
1. Don't reinvent constructs. If your XML looks like <element name="foo"><attribute key="bar" value="biff" /> </element>, you've got a problem. It should be <foo bar="biff"/>
2. Provide reasonable defaults. Everything should be optional.
3. Break up files into manageable chunks
I wish everything in /etc/ used a common format, like YAML, or a small set of common formats.
I also wish for good configuration libraries, which handled:
- Parsing / validating YAML config files, command line parameters, environment variables, database overrides, defaults, etc.
- Printing pretty error messages
- Worked in a few languages (Python, JavaScript, and perhaps C)
- Guided developers towards sane designs.
Also, if you're putting objects in XML, documents in YAML, or strictly tabular data in either, you're probably doing something wrong.
- YAML: Configuration files, objects
- XML: Documents
- CSV/TSV/TSVX: Tabular data
by jamesrom on 5/16/22, 6:51 AM
by gilbetron on 5/16/22, 1:31 PM
You can't make me love YAML!
(but I'll still use it and put my hatred to the side!)
by orthoxerox on 5/16/22, 8:34 AM
- YAML is fine when you can use it for last mile configuration and don't have to use it for everything else
Well, I agree. Take Helm, for example. values.yaml is a perfectly nice configuration file that you can even enjoy editing. The chart itself is an abomination of endless boilerplate (not Helm's fault, but inherited from k8s) and the worst possible templating mechanism bolted onto it (totally Helm's fault).
by voidfunc on 5/16/22, 6:06 AM
Other than the slow pace to bake and test golden images I still prefer this approach. It is simple and a proven design and easy to build-out on every single cloud provider.
I might be biased tho, this is how we manage the host's for our several thousand Kubernetes clusters. I'm just kind of used to it.
by nicoburns on 5/16/22, 3:33 PM
- Local variables
- Pure functions with basic math and string manipulation capabilities
Possibly with an extended version that also has:
- Input variables (that must be provided by the code reading the file)
- Exportable functions that are callable by the host code
This extended version would be perfect for use cases like defining CI pipelines.
A language that did this but was otherwise simple and allowed no access to the host system, and had widely available library support across most common languages would be just awesome.
by winrid on 5/16/22, 7:19 AM
by notreallyserio on 5/16/22, 1:18 PM
Significant whitespace is also a problem but I think that war has been lost.
by yegle on 5/16/22, 5:42 PM
A couple benefits: 1) all fields are documented and strongly typed, with backward and forward compatibility (old binary + new config, new binary+ old config works). 2) you can use any language to generate the config, simply specify your proto-generator binary as dependency. 3) if your config is simple enough and willing to lose some backward/forward compatibility, a text proto file is perfectly human readable/writable.
by baq on 5/16/22, 12:38 PM
change my mind.
disclaimer: hate both
by thangalin on 5/16/22, 7:16 AM
Isn't the problem more the tooling than the configuration language specification? Can you imagine authoring office documents by hand? Or maintaining them?
My text editor, KeenWrite, allows users to reference YAML variables as paths while editing documents. The editor includes a collapsible tree view of the variables, which makes navigation and maintenance a breeze.
https://i.ibb.co/qp0vj1Q/yaml-editor.png
Also, when inserting a variable into the document, the YAML tree expands automatically to the location the variable is defined. From the end user perspective, the data format is irrelevant.
Here's an example that produces a user-friendly UI for a JSON schema:
by vvladymyrov on 5/16/22, 7:14 PM
by kkfx on 5/16/22, 1:08 PM
Just compare Ansible/Salt YAML+python (because you can't do anything YAML-only) to Guix System, just see k*s YAML or Home Assistant ones: they are horrible to manage by a human. They are not much effective respect of anything else for a machine.
Long story short IMVHO it's about time to recognize that the old "data and language together" is the way to go, erasing common DSLs/formats/parsers etc.
by TeddyDD on 5/16/22, 7:05 AM
[1]: http://ix.io/3XTk
by rocqua on 5/16/22, 7:55 AM
What if the way you wrote the component does not allow some sort of dynamic config you need through YAML. Now you are working in two separate files and two different languages trying to make a change. Things almost get worse when the writer of the component and the consumer of the component are different people. Either massive horrible cludges happen to the YAML, or a weird back and forth needs to happen.
by whatshisface on 5/16/22, 5:53 AM
by cosmiccatnap on 5/16/22, 2:48 PM
Having recently migrated from cloudformation to terraform on a project the use of HCL is wonderful in comparison and when I'm all ready to commit I just type terraform fmt and everything is aligned properly. Considering it's just as trivial to do this in any JSON prettifier...I don't understand the need for yaml besides pure asthetics which is why you either love it or hate it, because it doesn't help or hurt it just annoys you or it doesn't.
by Taylor_OD on 5/16/22, 2:49 PM
I don't have a better solution but it just feels needlessly complex for text.
by forrestthewoods on 5/16/22, 7:55 AM
by sigmonsays on 5/16/22, 1:06 PM
We really need a language and not serialization format to describe configuration.
by rl3 on 5/16/22, 6:12 AM