Types of configuration files




















I would use YAML for more complex kinds of configuration. It's ability to contain comments, yet still be compact allows you to quickly write something new and document this.

However, I wouldn't use this for simple configurations, because it takes a bit of effort to get it to work. An example of the same configuration as before, but this time formatted in XML. XML, the markup languages a lot of people love to dismiss instantly. However, because it's been around for a while, it has proven to be very reliable and this also helped to include parsers for it in a lot of languages. A lot of languages either have native built-in parsers for it, or there are extensions and libraries for that you can use to extract data from it.

It also allows for comments, so you can inline all the needed documentation if you so choose. There are some dates as well. This isn't a problem if you don't have a lot of data or if you won't be sharing it with anyone. So files size could be relevant or irrelevant depending on your situation. Every time I have to parse the data in PHP I get a little overwhelmed by how complex the parser actually is. After a while you understand why it works this way though, so it will get better.

A simple mistake could invalidate your whole XML file. Looking at examples and experimenting with this will be useful. Browse by extension type:. Follow us! Sort by: Extension. Sort by: File type description. Net Code Security. NET Access Modifiers. Net Architecture. NET Data Types. NET Menu. NET Garbage Collection. Net Debug Trace.

NET Properties. NET Form. NET Assemblies. This can be good and bad. And in my estimation, the best format for this sort of configuration is TOML , because:. The syntax is intentionally very simple. Unlike JSON, it supports comments. Unlike INI, it has a proper spec. TOML is supported by all major programming languages. The only time I suggest not using TOML is if you find yourself in the unusual position of needing a more expressive configuration file format. Kubernetes is an example of a tool in this situation: defining all of the Kubernetes resources in TOML would be incredibly difficult, if not impossible.

It has many detractors. But it is fairly ubiquitous, so its annoying nuances are well documented and possible to work around. And if you need the complexity, you need it. What can you do? Reading YAML is fairly straight forward, but everyone seems to do it differently. YAML is truly expressive. So I lied a bit in the title.



0コメント

  • 1000 / 1000