Environment variables in VCL

Poul-Henning Kamp phk at phk.freebsd.dk
Tue Sep 10 06:44:45 UTC 2019


--------
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.


More information about the varnish-misc mailing list