Using defaults and nodefaults pseudo-channels to simplify configurations

and pseudo-channels
Many configurations involve repetition of various channel options on all or nearly all channels. Maintaining such a configuration is both tedious and error-prone. The MTA offers a simple way to change what options are set by default on various channels. This mechanism can be used to greatly simplify some configurations.

Note that in Unified Configuration channel neither multiple defaults channel nor the relative ordering of channels in the configuration are preserved. However, care is taken when the configuration is read to process the defaults channel first. As such, unified configuration is limited to having a single defaults channel that affects all subsequent channels.

If a line of the form: defaults option1 option2 option3 ... is inserted into the configuration, all channel blocks following this line will inherit the options specified on the line. The   line  can be thought of as a special channel block that changes the option  defaults without actually specifying a channel. The  line, or pseudo-channel definition, also  does not require any additional lines of channel block information (if  any are specified they will be ignored); in Unified Configuration terms, the   pseudo-channel does not need (and will ignore) any ,  , or   option settings.

There is no limit on the number of   lines that can be specified in a legacy configuration --- the effects of multiple   lines are cumulative with the most  recently encountered (reading from top to bottom) line having  precedence. Unified configurations are limited to a single defaults channel.

It may be useful to unconditionally eliminate the effects of any   lines starting at some point in a legacy configuration file (at the  start of a standalone section of channel blocks in an external file,  for example). The  line is provided for this purpose. It takes the form: nodefaults and has the obvious effect --- it nullifies all settings established by any previous   channel and returns the configuration to the  state that would apply if no   had been specified. This functionality is not available in unified configurations.

Like regular channel blocks, a blank line must separate each   or   channel block from other channel blocks. The   and    channel blocks are the only channel blocks which may appear  before the local channel in the configuration file. However, like any other channel block, they must appear after the last rewrite rule.

Initial configuration generates a  pseudo-channel located prior to any other channel definition (so applying to all other initially configured channels): msconfig&#x3e; show channel:defaults.&#x2a; role.channel:defaults.defaulthost = &/IMTA_DEFAULTDOMAIN/ &/IMTA_DEFAULTDOMAIN/ role.channel:defaults.maxjobs = 7 role.channel:defaults.noswitchchannel (novalue) role.channel:defaults.notices = 1 2 4 7

See also:
 * Other channels
 * Channel configuration