Hi,

>Are sample fetches only available in specific blocks

Small correction over my previous statement. It isn't like "var()" can't be
used in the backend block, as it works with the "http-request" directive.

Secondly, the correct line for server-template is,
server-template svcname 1-4 svcname.%[var(proc.dcname)].discovery.com  check
resolvers systemdns init-addr none

I simply made a mistake while writing the email.

On Wed, Nov 16, 2022 at 6:22 PM Abhijeet Rastogi <[email protected]>
wrote:

> Hi HAproxy community,
>
> There is a requirement to dynamically construct server/server-template
> lines based on some variables.
>
> *global section (dcname == us1) :- *
> set-var proc.dcname env(dcname)
>
> *Backend section:- *
> # svcname.us1.discovery.com is a valid DNS record
> server-template svcname 1-4 svcname.%[var(proc.dcname)].discovery.com
>
> It looks like this isn't possible because in my testing, it doesn't
> evaluate the var fetch while setting "server.hostname" from
> server-template. This seems to be true for the "server" directive as well.
>
> *Error with server block:- *
> Config: server abc.def.%[var(proc.dcname)] 127.0.0.1:1234
> Error: : character '%' is not permitted in server name
> 'abc.def.%[var(proc.dcname)]'
>
> * Can someone point to the section in the configuration guide
> <https://docs.haproxy.org/dev/configuration.html#7.3.2> which highlights
> this limitation?
> * Are sample fetches only available in specific blocks or directives? Is
> there a general rule?
>
> --
> Cheers,
> Abhijeet (https://abhi.host)
>


-- 
Cheers,
Abhijeet (https://abhi.host)

Reply via email to