Re: [exim] Conditional file include?

Top Page
Delete this message
Reply to this message
Author: Phil Pennock
Date:  
To: exim-users
Subject: Re: [exim] Conditional file include?
On 2007-08-24 at 16:34 -0500, D. Dante Lorenso wrote:
> Thanks for your RTFM suggestion. Did that. Was hoping someone might
> have an architecture recommendation on how I CAN do what I'm trying to
> do ...


Sorry, wasn't clear from the post that you had. There are enough people
asking for what's already clearly documented that it's normally the
right thing to do when replying in such cases: point to the relevant
part of the docs, to help people learn to find their way around them.

At $previous_employer, I arranged that the Exim config checked into CVS
had a couple of template macro definitions which were replaced by the
config install script. One for hostname, one for an index offset
programmatically determined from the hostname to get a value for
localhost_number, since we had shared storage. Maybe some others, I
forget. So "store-21", "1", and "store-21.fully.qualified" were all
available in macros.

Instead of using $primary_hostname you can use a macro which is set to
something fairly equivalent in value. Then .include_if_exists based on
that.

I know that macro usage is a slight performance hit but these boxes were
not CPU-bound so it wasn't an issue and the ease of management made this
a no-brainer trade-off.

Config install scripts aren't nice at a certain level, but this is part
of where using macros paid off: everything edited by the script was at
the top of the Exim config file and clearly commented.


Another approach which might be appropriate for you is to use the fact
that the built-in configuration file path is a colon-separated list of
filepaths to try, first existing file wins. You can then have a
exim.common file which is both in the path and .include'd by the first
file found. But since you can't solve your problem with
".include_if_exists exim.local.conf" perhaps not.


Is this a shared storage setup where only one top-level file is visible?
Do you need all of the config files on the shared storage? If so, can
you get away with the host system having an extra stage during setup?
/hoststorage/exim.local.conf --symlink--> /shared/eximconfs/hostname.conf


If none of the above are appropriate, then it depends upon what exactly
you're trying to do in the different host configs. For instance, if
you're applying different ACLs, then note that the various acl settings
for the main configuration are expanded strings, so you can pass control
off to different ACLs, with common stanzas in sub-ACLs. See Tony
Finch's excellent paper at:
http://www-uxsup.csx.cam.ac.uk/~fanf2/hermes/doc/talks/2005-02-eximconf/
which should probably be required reading for anyone designing an Exim
mail-system with more than one host comprising the system.

-Phil