Autor: Mike Cardwell Data: Para: exim-users Assunto: Re: [exim] if else statements in the config file
Jason_Meers wrote:
> I hoping to use a generic config on all of my boxes, but have the
> ability to override settings on a individual server basis.
> e.g. by having files like this in the /etc/exim/ directory
>
> local_domains_global
> local_domains_server1.example.com
> local_domains_server2.example.com
>
> And use a configuration like this:
> =========================
>
> prinary_hostname = server1.example.com
> ENABLE_CUSTOM_LOCAL_DOMAINS = TRUE
>
> .ifdef ENABLE_CUSTOM_LOCAL_DOMAINS
> domainlist local_domains = /etc/exim/local_domains_$primary_hostname
> .else
> domainlist local_domains = /etc/exim/local_domains_global
> .endif
>
> ==========================
>
> On the assumption that the config will set local_domains from
> /etc/exim/local_domains_server1.example
> if I leave the config as-is
>
> and would use
> /etc/exim/local_domains_global
> if I comment out
> #ENABLE_CUSTOM_DOMAINS_TRUE = TRUE
>
> 1) Have I understood this correctly?
>
> 2) Can anybody suggest a better way?
I would leave out the macro altogether and configure exim to use the
$primary_hostname file if it exists otherwise use the global one. Ie:
I would also drop the primary_hostname declaration altogether, allowing
Exim to figure out what it is, it's self. That way you have a truly
generic config file that you can drop onto any of your servers without
making any changes to.