Environment variables in VCL

Guillaume Quintard guillaume at varnish-software.com
Tue Sep 10 06:52:53 UTC 2019


True, but that amounts to template processing :-)

-- 
Guillaume Quintard


On Tue, Sep 10, 2019 at 8:44 AM Poul-Henning Kamp <phk at phk.freebsd.dk>
wrote:

> --------
> In message <
> CAJ6ZYQy5RnBjfCs88re6-hMfsQvyuzbOkHoofQ_c+suQNRQjig at mail.gmail.com>
> , Guillaume Quintard writes:
>
> >I see two ways:
>
> There is a third way:
>
> You can use:
>
>         include "somefile"
>
> anywhere and everywhere in a VCL program.
>
> Before you start your varnishd, do this in a shell script:
>
>         echo "\"$ENVIRONMENT_VARIABLE_HOSTNAME\"" > /somewhere/hostname.vcl
>
> Then in VCL:
>
>         backend b0 {
>                 .host = include "/somewhere/hostname.vcl" ;
>                 .port 80
>                 ...
>
>
>
> --
> Poul-Henning Kamp       | UNIX since Zilog Zeus 3.20
> phk at FreeBSD.ORG         | TCP/IP since RFC 956
> FreeBSD committer       | BSD since 4.3-tahoe
> Never attribute to malice what can adequately be explained by incompetence.
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://www.varnish-cache.org/lists/pipermail/varnish-misc/attachments/20190910/9d6ef430/attachment-0001.html>


More information about the varnish-misc mailing list