-
Notifications
You must be signed 8000 in to change notification settings - Fork 151
sconf config format is a bit cumbersome: rigid tab requirement, extremely long lines, etc. #319
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
Hi @QuadrupleA, thanks for creating the issue, certainly appreciated. I think you're right that the sconf format is causing confusion to some/plenty of people. It's essentially a new format. Indeed spaces are more common, YAML is used a lot. I understand how spaces have come about, with copy/paste in terminals often converting selected tabs into spaces. In my mind, that's the fault of the terminals or terminal editors, but that line of reasoning isn't helping anyone. Personally, in terminals I edit with vim, and typing tabs is easier than typing spaces, in part because on the machines where I use it, "AI" (autoindent) is disabled by default. When copying text, I sometimes filter it through unexpand to get my tabs back. Are terminal editors really commonly inserting spaces for indenting by default? I would hope modern editors automatically detect whether tabs or spaces are used in files, and work with that. The long lines also don't bother me. They just wrap to the next line. Only when editors wouldn't wrap long lines, but hide part of the line, that would sound annoying. But that's not the default in the terminal editors I use. Perhaps for some? Would be interesting to understand how this works for others. I'm not a big fan of JSON for config files. It requires typing too much syntax in my opnion. JSON5 is indeed better, but still requires typing typed values. Anyway, I can understand why sconf can be troublesome for some. We could look at something better. There's a lot of other work to do on mox, so it's not high on my priority list. It's also somewhat tricky to change the file format with existing installs out there. It would be useful to hear from people who do or don't have problems with sconf. What are the common problems? Typing and/or typing tabs vs spaces? Or learning the syntax (lists)? Or the line lengths? |
Sure thing, thanks for the reply. Yeah, unfortunately tabs are visually inconsistent thanks to legacy tooling / inconsistencies. Maybe sconf could support both ala python, where it just takes the first indent it discovers as the official "indent unit"? You're probably right that space-ifying tabs (e.g. VIM's "expandtab") isn't default in most editors, although I do use it in my own dev / .vimrc's. Here's what I get with the default .vimrc (haven't customized it on root on my mail VM) with ts=8 etc. on an 80x25 viewing mox.conf:
VS code etc. wraps more nicely, keeping it under the line's indent. Personally I don't mind the extra { or " here or there in JSON, and I like the explicitness of it. Probably the least learning curve too due to its ubiquity. Your call in the end of course, you obviously have a good design sense of keeping things simple which shines through in mox. And more important priorities for sure. As it gets more popular you'll probably have to battle a lot of people trying to convince you to add their pet features and complicate things, hope I'm on the simplicity side and not the pet-feature side :) Curious to hear others' thoughts too. |
I agree with QuadrupleA here. It really looks messy in a normal terminal. TAB is exactly 8 characters, so we get very deep indents which makes it hard to see the flow. The overlong lines as seen above do not help. It's often been said that the biggest mistake the I also am not too fond of only supporting verbatim single-line string values. Trailing whitespace is significant, and it is impossible to write a comment on the same line as the value. Explicit is better than implicit, which is why I prefer relaxed JSON over the mess that is YAML (too many edge cases cause problems for interoperability, e.g., the well known Norway problem.) That said, there is one really good thing about sconf: automatic schema validation since this maps exactly Golang structs. Every typo or missing required value will be caught automatically without the need to add explicit validation code. There is an interesting project kalled Pkl which adds a schema layer to existing configuration files. It does not support generation of Sconf (yet?!) - but it does have native support for Go - so perhaps that is worth a look? |
I love mox's self-documentation design (the config is the docs, and compiled into the executable) and its well-thought-out config organization.
This is just personal opinion and feel free to ignore, but I feel like the sconf format is a roadblock here, and hindering ease of use quite a bit.
Firstly: the requirement to use tabs - the default VIM config on most systems (and many other editors) uses 8-space tabs, which makes indents quite large and unwieldly. Python, the most common and popular "whitespace is significant" language like this, recommends spaces. YAML doesn't even allow tabs. Many modern text editors automatically replace tabs with spaces by default.
So automatically users are fighting against the tide trying to edit mox.conf and domains.conf without breaking them.
Secondly: long lines - my mox.conf has lines that blow out to 126 characters (e.g.
CertFile
paths), so while every other service I administer can happily work in a small 80x25 terminal window alongside other windows, mox always forces me to maximize the window or stretch it to take up half my screen. Granted we have big screens now, this isn't 1985, but there's kind of a defacto standard of 80-90 columns ish which makes it nice when dealing with a lot of different services. Incidentally this is also good typography and good for readability.JSON5 could be an awesome drop-in replacement for sconf (it has a few popular go implementations). Basically JSON but relaxed somewhat, allowing comments, trailing commas, etc.
IPs
below) can be one-linersSample:
Again just my opinion - don't know all the internal considerations so feel free to ignore. But loving this project overall and I feel like it serves an important mission, to help decentralize email and make it more accessible to self-hosters, so would hate the config format to get in the way.
The text was updated successfully, but these errors were encountered: