> On Apr 2, 2021, at 2:02 PM, Jeremy Harris via Exim-users <exim-users@???> wrote:
>
> On 02/04/2021 17:08, Felipe Gasper via Exim-users wrote:
>> domainlist mydomains = foo.com : bar.com
>> … is there any way to pass that domain list to, e.g, ${reduce}?
>> For testing purposes I’d like to do something like:
>> -----
>> ${reduce {+mydomains}{}{${if eq{$value}{}{}{$value,}}$item}}
>> -----
>> … and have it give me “mydomains”, joined with a comma.
>
> ${listnamed_d:mydomains} as source for your reduce.
>
> Bear in mind that you a vulnerable to list elements
> that already have an embedded comma, and ones with
> an embedded colon may surprise you.
>
>
> It'd be nicer if listnamed had a way of getting a
> custom output separator, and/or if reduce did full
> list expansion, of course.
So, the list in question is defined thus:
domainlist manualmx_domains = ${if exists {/etc/manualmx} {lsearch;/etc/manualmx} {} }
When I expand ${listnamed_d:manualmx_domains}, I get just the definition part of the above. So that doesn’t help.
I also tried expanding:
${if forany{${listnamed:manualmx_domains}}{eq {$item}{domain.tld}}{yes}{no}}
… where “domain.tld” is the domain I’m looking for, but still no dice.
I also tried:
${if inlist{domain.tld}{${listnamed:manualmx_domains}}{yes}{no}}
… but that doesn’t work, either.
I assume the issue is that the list is defined as dynamic … is there any expansion string that handles that?
Thank you!
cheers,
-Felipe