Mailing List Archive

[Bug 3083] Allow multiple uses of options defining servers for database lookups
https://bugs.exim.org/show_bug.cgi?id=3083

--- Comment #1 from Jeremy Harris <jgh146exb@wizmail.org> ---
The pure Exim (i.e. non-jinja2) way would probably be feature-macros and
.ifdef's

mysql_servers = localhost::PORT_N/test/root/ : \
.ifdef FUBAR
localhost::PORT_D/test/fred/ : \
.endif
HOSTIPV4::PORT_D2/test/bill/ :

I assume that is not workable for you?


To support multiple uses, appending, of these options we'd want new syntax.
I'd rather avoid a global mode-switch... so either a per-line modeswitch
keyword

append hide mysql_servers = localhost::PORT_D/test/fred/

or a different assignment operator (might fall foul of where the re-use check
is
currently coded though)

mysql_servers += localhost::PORT_D/test/fred/

--
You are receiving this mail because:
You are on the CC list for the bug.

--
## subscription configuration (requires account):
## https://lists.exim.org/mailman3/postorius/lists/exim-dev.lists.exim.org/
## unsubscribe (doesn't require an account):
## exim-dev-unsubscribe@lists.exim.org
## Exim details at http://www.exim.org/
## Please use the Wiki with this list - http://wiki.exim.org/
[Bug 3083] Allow multiple uses of options defining servers for database lookups [ In reply to ]
https://bugs.exim.org/show_bug.cgi?id=3083

--- Comment #2 from Marten Lehmann <lehmann@cnm.de> ---
The .ifdefs rely on at least one initial datasource, which I cannot guarantee.
The independent features might use:

.ifdef FEATURE1
hide pgsql_servers = server1/database/username/password
.endif
.ifdef FEATURE2
hide mysql_servers = server2/database/username/password
.endif

Your second syntax suggestion ("+=") looks more appealing to me.

--
You are receiving this mail because:
You are on the CC list for the bug.

--
## subscription configuration (requires account):
## https://lists.exim.org/mailman3/postorius/lists/exim-dev.lists.exim.org/
## unsubscribe (doesn't require an account):
## exim-dev-unsubscribe@lists.exim.org
## Exim details at http://www.exim.org/
## Please use the Wiki with this list - http://wiki.exim.org/
[Bug 3083] Allow multiple uses of options defining servers for database lookups [ In reply to ]
https://bugs.exim.org/show_bug.cgi?id=3083

--- Comment #3 from Jeremy Harris <jgh146exb@wizmail.org> ---
(In reply to Marten Lehmann from comment #2)
> The .ifdefs rely on at least one initial datasource, which I cannot
> guarantee.

Can you give an example?

--
You are receiving this mail because:
You are on the CC list for the bug.

--
## subscription configuration (requires account):
## https://lists.exim.org/mailman3/postorius/lists/exim-dev.lists.exim.org/
## unsubscribe (doesn't require an account):
## exim-dev-unsubscribe@lists.exim.org
## Exim details at http://www.exim.org/
## Please use the Wiki with this list - http://wiki.exim.org/
[Bug 3083] Allow multiple uses of options defining servers for database lookups [ In reply to ]
https://bugs.exim.org/show_bug.cgi?id=3083

--- Comment #4 from Marten Lehmann <lehmann@cnm.de> ---
You already gave good examples by yourself :)

This line in your example defines the first datasource:

mysql_servers = localhost::PORT_N/test/root/ : \

It ends with a colon (indicating there will be more sources following) and a
backslash (indicating further details will follow on a new line). An agnostic
configuration block for a single feature doesn't know though, whether there
will be more datasources in general, more datasources of the same type and
whether they will follow immediately on the next line or in a later segment of
the configuration file.

This block in your example adds an additional datasource:

.ifdef FUBAR
localhost::PORT_D/test/fred/ : \
.endif

It doesn't define a type of datasource though, so it requires a prepending
block of the same type. That way it's not an independent block any longer.
Also, the line is ending with ": \", expecting another datasource the follow.
An agnostic configuration for a single feature is not aware of it's position in
the list of datasources nor does it know whether more datasources will follow.

Using your suggested += syntax, the same example would look like this:

mysql_servers += localhost::PORT_N/test/root/
.ifdef FUBAR
mysql_servers += localhost::PORT_D/test/fred/
.endif
mysql_servers += HOSTIPV4::PORT_D2/test/bill/

It looks way more nice and clean to me. It would blend in perfectly without
breaking existing configurations.

--
You are receiving this mail because:
You are on the CC list for the bug.

--
## subscription configuration (requires account):
## https://lists.exim.org/mailman3/postorius/lists/exim-dev.lists.exim.org/
## unsubscribe (doesn't require an account):
## exim-dev-unsubscribe@lists.exim.org
## Exim details at http://www.exim.org/
## Please use the Wiki with this list - http://wiki.exim.org/
[Bug 3083] Allow multiple uses of options defining servers for database lookups [ In reply to ]
https://bugs.exim.org/show_bug.cgi?id=3083

--- Comment #5 from Jeremy Harris <jgh146exb@wizmail.org> ---
I've not checked specifically for mysql_servers, but a standard Exim list
ignores
a trailing list-separator; there is no "last" list element implied by one.

So long as you leave an empty line afterward, a trailing backslash will have no
effect;
it does no imply there will be further information on the next line.


> It doesn't define a type of datasource though so it requires a prepending block of the same type.

mysql_servers = \
.ifdef FOO
localhost::PORT_D/test/fred/ : \
.endif
.ifdef BAR
HOSTIPV4::PORT_D2/test/bill/ :
.endif

Better? These elements are only text, while the ifdefs get resolved. They do
not
have types or semantics until the entire resulting list is evaluated when (and
if) the
"mysql_servers" global option is needed for a lookup.

--
You are receiving this mail because:
You are on the CC list for the bug.

--
## subscription configuration (requires account):
## https://lists.exim.org/mailman3/postorius/lists/exim-dev.lists.exim.org/
## unsubscribe (doesn't require an account):
## exim-dev-unsubscribe@lists.exim.org
## Exim details at http://www.exim.org/
## Please use the Wiki with this list - http://wiki.exim.org/
[Bug 3083] Allow multiple uses of options defining servers for database lookups [ In reply to ]
https://bugs.exim.org/show_bug.cgi?id=3083

--- Comment #6 from Marten Lehmann <lehmann@cnm.de> ---
You are right, technically it indeed works as you suggested. But is that really
a configuration file you'd like to see in the wild? Do you think most exim
users with immediately understand a block that looks like this and _not_ assume
there's some error in the configuration or at least be surprised this actually
works?

# BEGIN
mysql_servers = \

pgsql_servers = \

#END

or

# BEGIN
mysql_servers = \
localhost::PORT_D/test/fred/ : \

pgsql_servers = \
HOSTIPV4::PORT_D2/test/bill/ : \

#END

I checked for "+=" notation you suggested initially, but that's not the actual
exim style. Correctly it would be

mysql_servers = +localhost::PORT_N/test/root/
.ifdef FUBAR
mysql_servers = +localhost::PORT_D/test/fred/
.endif
mysql_servers = +HOSTIPV4::PORT_D2/test/bill/

That's similar to

domains = +local_domains
openssl_options = +no_sslv2 +no_sslv3
hosts = +relay_from_hosts

and so on. I'm not sure what's involved to extend the database options to the
same behavior, yet I still think it's a desirable thing and I'd highly prefer
it to the workaround.

--
You are receiving this mail because:
You are on the CC list for the bug.

--
## subscription configuration (requires account):
## https://lists.exim.org/mailman3/postorius/lists/exim-dev.lists.exim.org/
## unsubscribe (doesn't require an account):
## exim-dev-unsubscribe@lists.exim.org
## Exim details at http://www.exim.org/
## Please use the Wiki with this list - http://wiki.exim.org/