I’ve worked with or touched many configurable systems.
Some are home-brew, some are open source tools, and all have some kind of configuration in one file format or the other…
*.edn, *.yaml, *.xml, *.json, (jsonnet) *.config. *.cfg, *.ini, *.js, *.py… the list goes on. Don’t get me started on kubernetes yaml and terrorform!
It can even be as simple as an
opts argument to a function.
I’ve even worked with projects that had multiple types of config files…
I don’t want to remember those dark times… anyways.
Some issues that results from a configuration.
- What the options are are not obvious, not documented, or really hard to find in the documentation.
A documentation issue. But perhaps it is a deeper problem as well?
- What the values of the options can be is a mystery
That is to say, what is the valid matrix of options that the option parameters can be in. if option A is X, for example, option B is not allowed to be Y. Or even, what is the valid subset of strings that can go into this json field???
- How do I change my configuration so that it works with your new update of the software?
For example, in version 1, the default of X is 512, but in version 2, the default is 256. However, it had never been required (or documented) in the settings file (true story, this broke something at work once).
So I’m really curious to see how you solve these three problems.
- documenting the available options; how do you communicate to the users of your software/code/libraries how to properly work with it, and how do you enable them to do so?
- what options are incompatible. How do you describe this?
- what options need to be changed in the new version
I’m thinking that in an ideal world, I would have a piece of the code that generated a valid configuration, and also updated old configurations to a new one. But this can imply inescapable pitfalls. It feels kind of related to the expression problem.
I feel that a config file is like a puzzle piece that needs to fit just right, and it is easy to write them in such a manner that it becomes an impossible puzzle with exponentially many options and combinations of options.
Maybe someone already made a software for this, with config migrations, and all that good stuff , if so, please tell me about it.
spec might work for some parts of this problem, but definitely not all…
It’s difficult to google this subject for me, because all I get is ‘How to choose your configuration file format’ type thing.
I would like to hear your experience, and your way of dealing with it… maybe there is some wonderful insight out there.