In 2008, before many of the options for configuration that are available now had been created, I came up with a hierarchical configuration language [0] to use in my Python code. More recently, I had a look at some of the newer options available (JSON5, HJSON, HOCON, SANE and TOML), but still find them wanting in various ways. The latest iteration of my take on it [1] is now available in multiple environments (Python, the JVM, .NET, Go, Rust, D and JavaScript). I would welcome any critique from the HN community.
I really like TOML. It's very similar to old-school INI files except it has a standard and parsers in quite a few languages. It does has its own downsides (while the concept of tables is quite useful, it can be a bit tricky to understand when you first see it). But it's one of the least-bad "modern" configuration formats I've seen.
This is what I do whenever possible. And bonus if your scripting language is statically typed. My projects use TypeScript configurations, with the `config` import statically typed and each configuration file checked against those types. It's a great way to ensure you don't miss a config change for an environment you're not working on at the time.
Many reasons to prefer a static declarative config over a dynamic imperative one. Sometimes the latter makes more sense, but there is very much a need for the niche YAML tries to fill
I want my configuration to be guaranteed to halt for one, I don’t want my configuration to have the ability to open sockets, I don’t want configuration to import business logic or 3rd party modules, etc.