YAML is an okay enough configuration file format
Ever since we set up Prometheus, I've had to deal with everyone's favorite configuration syntax to hate, YAML. Although YAML isn't universal in the Prometheus and Grafana ecosystem, it's pretty pervasive and many components and things you want to use are configured using it as the configuration syntax, so I've had to write and read plenty of it. While I have my issues with YAML, over time I've come to feel that it's an okay enough syntax and that often, the big picture issues aren't because of its syntax.
There have definitely been general languages for configuration that I am quite not fond of (I have a low opinion of writing XML by hand, for example). I don't find YAML to be like this. The syntax is simultaneously picky and lax, and deeply nested things can be hard to follow, but overall it's inoffensive to write, modify, and read (although you really want to get your editor to cooperate with its indentation; YAML is the one thing I actively configure vim for).
There are simpler formats for simple situations, such as TOML, but YAML has mostly won in practice in the areas that I work in. I believe that Python has steadily moved toward liking TOML, to the extent that tomllib is now in Python's standard library. In a way I wholeheartedly support that; if your program needs enough of a complex configuration that TOML doesn't work well, you probably should take the effort to create a focused configuration language for it instead of leaning on a serialization format. But as what is fundamentally a serialization format, YAML is okay.
(Well, the subset of YAML that people use in practice is okay. There are some esoteric features that people mostly don't touch, for good reason, like repeated nodes that use '&' and '*'.)
It feels a bit heretical to say this, but sometimes there are things that it's not worth having really strongly expressed views on. For me, YAML is one of those things. I may not really like it but I can certainly live with it if a project decides to use it. I'm not going to pick one project over another merely because one uses TOML and the other YAML, for example.
(This is pretty much a system administrator's view, which is to say the view of someone who uses systems configured with YAML and writes their configuration files. Programmers who have to decide how their system is configured can and probably should have stronger views and better reasons for picking one particular format than 'it's inoffensive and it's there'.)
|
|