JSON is a bad config file format
@sir Depends. Human-written configuration: Definitely. But machine-generated configs? It's not worse than the other formats.
>> JSON is a bad config file format
> Depends. Human-written configuration: Definitely. But machine-generated configs? It's not worse than the other formats.
Well, I'd argue that a file is intended to be read/written *only* by a computer isn't really a config file – it's a bit of serialized data (which is only incidentally config data). And storing serialized data *is* one of the few good use-cases for JSON.
But I acknowledge that might be splinting semantic hairs
@sir the worst!
@sir Yes, but I don't know that YAML is much better.
I've met a few too many people who seemingly cannot tell 3 spaces apart from 4 spaces.
There's always a tough choice between super simple config style and support for lists and dicts.
The latter isn't always required, but it's always annoying when you suddenly do need it.
@net it's fine but if you can get away with INI you should use that instead
@sir and what about yaml?
@xsteadfastx it's alright for a few specific use-cases, but it's also a footgun so it should be used with care. It's also way too complicated and I would never want to write an implementation
@sir just offtopic but its like my personal hero just answered me ;-)
@sir TOML might be the best thing to happen to config files since sliced bread.
JSON is fine as a human-readable interchange format, but really annoying to write by hand.
@sir Didn't you some time ago say something against programming languages without a specification? I mean clearly it's not exactly the same, but INI files are parsed differently between parsers while TOML files aren't. I wouldn't use INI for new projects anymore.
@geosum there's very little need for the format of your config file to be portable between applications. What are you going to do, hand your .vimrc to Firefox?
@sir What I actually meant was that you can get familiar with toml once for all applications that use it. For INI, you could configure two applications where one of them supports something the other doesnt for the configs syntax-wise which would be confusing.
@sir when wrestling with a TOML config that gets into the deeply-nested dicts, I wish they'd just use json or yaml instead.
@sir I ended up doing a config file format based on Python's indentation philosophy. It doesn't take much to parse:
and config files can be moderately complex/nested while staying human editable, for instance:
@vandys this seems pretty decent but you should put it on 443 and add https
@sir In general, there's support in that middleware for SSL:
TIS doesn't use it because we can't afford to have certs expire during a disaster (or assume that we can reach a CA if they do)
@vandys you can make certs update themselves, this is no excuse
@sir If you have Internet. That thing is for DISASTER operations. You don't know when it'll happen, or how long it'll last. Totally different design space from securing the net for commerce.
@vandys you can do weekly renewals to get 80-90 days of working cert, or you can still buy certs for terms like 1 year+, or you can offer both with and without https. And if you don't have internet you're not going to reach this web host anyway. Give me a break
@sir You don't appear to know much about deploying disaster networks. Let's leave it at that.
@vandys I know plenty, but you seem to prefer thinking of me as having the average intelligence of /dev/null rather than step one toe outside of your ivory tower of ignorance. I hope you get MitM'd, twit
@moonman ini also has comments
@sir I just know I don't like complex formats or difficult parsing. Also, a config file format really needs comments, which JSON technically doesn't support AFAIK.
So yes, JSON is bad, but TOML is also already a little too much for me...
If you ask me, INI is great for that job. Sometimes I think that Lua is great, too. But then: loops in config are kinda overkill and can result in denial of service.
@sir I'd prefer toml to ini
@prashere it's easier for machines to write than humans. Too many rules for humans to be aware of and deal with, like trailing commas, quoting everything, escaping stuff, no support for multi-line strings...
@sir Thank you, Captain Obvious.
@sir have you heard of XML? It's the perfect format for any serial data! :^)
The social network of the future: No ads, no corporate surveillance, ethical design, and decentralization! Own your data with Mastodon!