5 ms·
I don’t understand it either. JSON and YAML do not belong in *nix config files. What else will systemd do next? Audio? Kernel functions? Send mail? Read news?
by opless 7y ago
I don’t understand it either.
JSON and YAML do not belong in *nix config files.
What else will systemd do next? Audio? Kernel functions? Send mail? Read news? Become a web browser?
- LessDmesg 7y agoBecome Windows. That was Red Hat's plan all along. And then your personal data will end up on their cloud like with Win10.
- syshum 7y agoit took IBM 4 years before it ruined Weather Underground and injected its corporate cancer on the Apps and Sites So I figure it will no later then 2023 before RedHat becomes IBM...
- deleted 7y ago[deleted]
- catalogia 7y agoTIL IBM bought the Weather Channel a few short years after the Weather Channel bought Weather Underground.
- Spivak 7y agoI can agree with JSON being inappropriate in some circumstances but YAML is a super ergonomic config format. It gives you lots of niceties when you editing a file by hand and then you can just output a JSON object if you're generating the config with code. It's my favorite thing ever to do something like: - name: Configure $service. copy: dest: /path/to/config.yml content: >- --- {{ config_obj | to_nice_json }} in Ansible.
- edejong 7y agoYAML is probably the least ergonomic configuration format available. [1] Even XML would be preferable, as at least most XML parsers are interchangable. [1] https://www.arp242.net/yaml-config.html https://www.arp242.net/yaml-config.html
- jrockway 7y agoI don't think YAML is the least ergonomic configuration format available. It has comments, unlike JSON. YAML's super clever upgrading of strings into other types is irritating ("foo: yes" is type {foo boolean}). Indentation-based semantics are not for everyone, and I think most of us would not mind the "noise" of braces. Other than that it's pretty OK. It's easy to write code that reads and writes it. It's very easy to read. It's above average but not prefect for writing (again, braces are pretty okay, not sure why they went the indentation route). I agree with the article you linked that a lot of YAML implementations in scripting languages do dumb things like letting you put code in the file, and they all parse their special features differently. A config format does not need to be portable; while all these implementations do different things, they follow a format that continues to allow something to parse the entire file. So you can write an auto-formatter in Javascript (prettier) even though a Go program (kubectl) is going to actually read the file, and it all works. I have used many other formats for config files. They all suffer from their fair share of problems. TOML/INI handles nesting very poorly (making you retype the names of all parent keys). JSON doesn't let you write comments or trailing commas, so it's hard to work on in your editor (running prettier on save fixes the trailing commas though). Text protobuffers are great but people look at you weird when you use them. XML is a travesty. It is hard to write and hard to parse. It does all sorts of confusing things that humans do not expect, so it's really more of a binary format for computers to use than a text format for humans to write. (Remember, the XML spec says: <foo> bar </foo> is different from "<foo>bar</foo>" even though humans think they're the same.) XPath querying is great, I love it. But we have "jq" now that works on JSON and YAML. Anyway, I think YAML is basically a fine format for config files. Perfect? Nope. OK? Yup. I will happily read or write a YAML file in a computer program or by hand. It's pretty OK.
- 0xffff2 7y ago