Thinkpiece: alternative config option over /etc/.../50-config.conf
root@7c32f54356fc:/# tree /etc/apt/apt.conf.d/ /etc/apt/apt.conf.d/ |-- 01autoremove |-- 70debconf |-- 99-yes-install.conf |-- docker-autoremove-suggests |-- docker-clean |-- docker-gzip-indexes `-- docker-no-languages
What is going on in .conf.d
directories
- packages have configuration
- configuration lives in directories
- directories are maps of filenames to file contents; filenames can have a priority number (99-something.conf overwrites 50-something.conf).
- file contents are arrays of lines
- lines are key:value pairs
- multiple lines can contain the same config value; the later ones overwrite the earlier ones.
Basically the entire configuration, spanning the whole file system, can be reduced to a single json object. A package could force users to configure it in a single json object (and some do), but writing json by hand has ergonomic issues, and multiple packages might want to write config, and they may conflict. Who wins is undecidable from the packages' point of view, but the config should at least be consistent for a given filesystem state.
Issues
99-filename.conf looks strange, and invites potentially unnecessary user decisions on how to name their configuration options, rather than one opinionated standard. The basic problem is how to have individual array elements assert their position.
I suppose it would work fine to just say "it's alphabetical" and let files name themselves 000000-MEFIRST.conf if they really care or <some gnarly unicode character>-MELAST.conf if they care. But most config can just be something like /etc/apt/apt.conf.d/config.conf. A lot of redundancy but at least it's only communicating 2 concepts: "I am config" and "the config is for apt". I think I'll do that.