1. 35
  1.  

  2. 16

    I made the mistake of reading the Hacker News comments on this story:

    I’m amazed we still use configuration files like that. Why not have some capable programming language (python, javascript) handle the configuration?

    1. 4

      ಠ_ಠ

      1. 4

        Depending on how well that user knows OpenBSD, this question may in fact be a good one:

        1. Why use a yet another different text format for configuration instead of JSON/XML/YAML/TOML? OpenBSD tools such as pf, OpenSMTPd and the new httpd (others? I’m not familiar enough) actually share the same syntax, so learn one, be comfortable in the others.

        2. Why use a configuration language instead of a programming language? Though Turing-complete languages have proven themselves useful in the configuration of many applications (e.g. Emacs, Xmonad), they can be sometimes overwhelming for non-programmer users and a simpler language actually is a feature.

        1. 4

          Not really a reply, but I’d like to add to that:

          JSON and XML are bad configuration languages. The other two have issues.

          a) Comments are inconvenient (XML) or not possible (JSON)

          b) Both make the “adding a line” hard - JSON because of its hash syntax that requires “,” after every line except the last, making “growing the config” hard. XML because of its general verbosity.

          c) Generic data formats as they are, they often don’t check for options that are not valid, encouraging misconfiguration through typos. (XML as it should be used being an exception)

          I like YAML, because it has references, but there are also surprising parts in that language. Also, I find checking of validity hard. Also, there are at least two styles for everything ;). I see why people don’t like it.

          I don’t like TOML that much - it has many of the issues mentioned in c) and some of the “there are two ways of writing things”. Also, I have no mental mapping between what I wrote in TOML and the actual configuration key in the software in the end.

          1. 1

            Both make the “adding a line” hard - … XML because of its general verbosity.

            I don’t see why verbosity makes adding a line hard. I think xml is a great choice. It can be easily validated on any platform with xsd, and re-rendered if desired with a number of techniques.

            1. 1

              json doesn’t support comma after the last element?

              1. 1

                No, because older Javascript interpreters don’t support/ignore them, which is why you get this wonky-ass comma-first style that became popular with the node.js crowd.

          2. 2

            Like Scons, which substitutes Makefiles for python code? It’s an utter disaster of undocumented time suck.

            1. 1

              Well, I see the point, but once you start building Makefiles using autotools, you are in a mess of undocument time suck in M4.

          3. 9
            1. 2

              Looks like httpd doesn’t support setting headers yet – would love to give it a try again if/when it does though.

              1. 1

                Yep. It works for my use case of serving static files. Haven’t had problems.