HACKER Q&A
📣 logicallee

What do you like to see in a configution file format?


I'm working on a home automation system anyone can set up for themselves with one central configuration file[1]. What do you like to see in a configuration file format?

[1] based on this: https://github.com/robss2020/computerplayverysexymusic


  👤 dan_linder Accepted Answer ✓
As someone who's dealt with configuration files for many years in formats such as ini, xml, json, yaml, etc. not to mention all of the custom binary configuration file formats such as the Windows registry, or other system bespoke configuration file formats, in the end what works best for me and possibly most people is a configuration file format that is human readable and maintainable with a simple text editor or even basic command line tools.

I'm glad most of the industry has got away from the binary blob for configuration file, but I don't see great advances that the new configuration file formats such as TOML or others I'm not aware of provide above a basic yaml or json file.

my personal preference is yaml followed by jason, and from what I understand the ability to convert between those two formats is because both have feature parody with the other. I might be wrong, but as long as a system can ingest either of those I find it my preference to use that over something else. maybe if I had a third place file format it would be ini, but it has a lot of restrictions on the type of data structures it can convey.


👤 ggeorgovassilis
- legible: readable and editable without special programmes

- documentation generator: aside from "human readable", have tooling support for documentation generation

- syntax/plausibility checking: tooling support for consistency checks

- UTF8 support

- variables: specify and populate placeholders

- modularisation: compose configurations out of reusable modules

- templates: something like #define in C

- concise: json, yaml and xml are too verbose imho. Maybe make use of special characters like ,!() etc for syntactical brevity

- unambiguous: indentation, capitalisation, the type of quotes etc shouldn't be syntactically relevant

- pluggability: APIs & libraries that allow using the language in my programmes


👤 duped
I don't actually want a configuration file most of the time, I want to describe the whole thing as real code. Give me a JavaScript entry point instead.

👤 chunk_waffle
1. Comments

2. I like the separation of data and the program and am not the biggest fan of using a full scripting language as a config file (sometimes popular js, php, and lua)

Bonus: Some way to specify variables for reusable values, not a deal breaker though.

Bonus 2: Not having to learn a radical new config file format.


👤 verdverm
CUE (https://cuelang.org)

Why would you want to build a new format over using an existing one?

Is it a good idea to still force a single file once the configuration reaches some sufficiently large size?