mjl- / mox

modern full-featured open source secure mail server for low-maintenance self-hosted email
https://www.xmox.nl
MIT License
3.7k stars 111 forks source link

"parsing dynamic config file: :94: expected indent" after deleting an account or local part #133

Closed ally9335 closed 9 months ago

ally9335 commented 9 months ago

After removing an account or local part, I don't remember which, in the config x will remain hanging thus causing an error when mox is restarted

image

===>

l=fatal m="loading config file" err="parsing dynamic config file: :94: expected indent" pkg=mox
mjl- commented 9 months ago

This looks like a snippet from the example configuration file. Such as shown at https://www.xmox.nl/config/#cfg-domains-conf-Accounts-x-Destinations-x. But that snippet isn't complete yet. The "x" should be an email address, followed by a colon, followed by either additional lines with extra indenting containing config options (such as shown in the config link, e.g. Rulesets) or by just nil right after "x: " to indicate there are no further options (but making it a valid "map" from email address to values (the "nil" isn't pretty...).

If the line said "x: nil", there would be no error (but "x" is probably not the email address you wanted to configure). Because there is no value after the colon on the same line, the config parser will look at the next line, expecting to find another indent. But it finds a line that has a shorter indent, instead of the expectated 1 longer.

Was this addition the result of an operation by the admin web interface? Or did you copy/paste a snippet from an example config file? If the first, that's certainly something to fix. If the second, hopefully we can update instructions/explanation in places to prevent future confusion. Suggestions welcome!

ally9335 commented 9 months ago

No idea how this could've happened. I've fixed it.

mjl- commented 8 months ago

I ran into this just now too, mox can create this broken config file by itself. I'll fix it soon. I should have investigated this more thoroughly, sorry. Thanks for reporting!