airbnb / nerve

A service registration daemon that performs health checks; companion to airbnb/synapse
MIT License
942 stars 151 forks source link

use YAML rather than JSON for configuration files #25

Closed memory closed 10 years ago

memory commented 10 years ago

JSON is an excellent tool for simple data interchange between servers, but is a royal pain as a configuration file format which must also be written and read by human beings. The difference between valid and invalid JSON is often down to a single character in hard-to-spot places:

{ "valid_json?":
  { "lets":
    ["play",
     "spot",
     "the",
     "syntax",
     "errors",
   ]
  },
}

(It gets even worse if you want to generate valid JSON in the context of, say, an ERB/moustache template file: ugly logic must be invoked to make sure that lists are terminated correctly.)

Even worse: correct JSON does not allow for comments. And while you can certainly do:

{ "this_dict": {
    "has": "values",
    "and": "a",
    "comment": "which is me!" }
}

...it's much harder to do something like this:

{ "this_dict": {
    # TODO: restore when bug #7 closes
    # "has": "values",
    # "and": "a",
    "comment": "which is me!" }
}

...whereas all of the above strings are valid and correct YAML.

memory commented 10 years ago

thoughts? :)