hopfenspace / MateBot

Micro service providing an API for MateBot clients

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Should we change the format of the config file to INI/TOML style? What about YAML?

CrsiX opened this issue · comments

commented

Currently, we use a growing JSON file (config.json) to store our configuration data. However, we should think about changing this format.
What's against JSON? While not required, it's only readable with indentation. If you mix up tabs and spaces (which happend sometimes), you literally break the whole config file. Furthermore, it's not that beautiful to have all keys in "quotation marks". Additionally, parsing it is easy in Python (json.load(...) or even eval(...) would do it in some cases). But creating a schema file and checking the syntax is not so easy. And lastly, a lot of configuration files for GNU/Linux or UNIX are of an INI-style format (while JSON is rare).

What other options do we have? Well, a lot. I would prefer a INI- or TOML-like syntax. There's also at least one great Python library (pip install toml) we could use for this purpose.
What about INI? I think it's better as it doesn't require to use "quotation marks" at all. There's this minimal library as well as the standard library module which suits our needs to read those files.
What I don't like so far is the lack of list support. Creating e.g. consumables becomes crappy this way or must be exported into another file.

While being open for discussion, I don't vote for YAML at least because of its fails in easy readability.

As we don't want to have unnecessary dependencies when not needed for any key feature (which the config format is not imho) while having a format which supports everything we need.

As you voted against YAML for its lack of readability, I vote against using INI as this argument also applies when compared to json files.