Testing validity of Dovecot config in a script
While trying to determine a given configuration is valid from within a script, I found that the following works with Dovecot version 2.3.2.1:
#!/usr/bin/env bash doveconf -n >/dev/null || echo "Config is invalid"
However, the return code is not documented in the doveconf manual page, and I wonder if the observed behaviour can be relied on? Is this the recommended method to test configuration validity?
Personally, I'd like to have a dedicated call available. Something like
# Proposal: "-t" for "test config" doveconf -t [-c config-file]
with documented return codes would be ideal.
-Ralph
On 24 November 2018 at 16:45 Ralph Seichter m16+dovecot@monksofcool.net wrote:
While trying to determine a given configuration is valid from within a script, I found that the following works with Dovecot version 2.3.2.1:
#!/usr/bin/env bash doveconf -n >/dev/null || echo "Config is invalid"
However, the return code is not documented in the doveconf manual page, and I wonder if the observed behaviour can be relied on? Is this the recommended method to test configuration validity?
Personally, I'd like to have a dedicated call available. Something like
# Proposal: "-t" for "test config" doveconf -t [-c config-file]
with documented return codes would be ideal.
-Ralph
doveconf will reliably fail if config file cannot be parsed. It will not catch all possible misconfigurations, but it will catch most. Particularly plugin settings are not validated.
Aki
participants (2)
-
Aki Tuomi
-
Ralph Seichter