Choosing a text format to save our data
We will look at three popular configuration file formats in this section:
- INI
- JSON
- YAML
All three formats find applications in certain fields but may not be suitable in others.
The INI file format
One of the oldest formats to store configuration data is the so-called INI format. The name comes from the file extension .ini
, which is a three-letter abbreviation for initialization. An INI file is mostly used to configure programs.
In the INI file, simple key/value pairs are stored and organized in optional sections. A section name is enclosed in square brackets, and the section scope runs from the start of the section to the start of another section, or the end of the file.
Here is an example of a section and some key/value pairs for a database connection:
[database-config]
type = mysql
host = mysql
port = 3306
user = app1
password = ASafePassWord1#
Sections can be nested to create some sort...