Environment variables in VCL

Hugues Alary hugues at betabrand.com
Mon Sep 9 22:06:51 UTC 2019


Hi there,

I'm using Varnish in a Kubernetes cluster and my configuration needs to use
environment variables.

More specifically, I'm trying to declare a `backend` with a `.host` whose
value is an environment variable.

backend b0 {
  .host = "*$ENVIRONMENT_VARIABLE_HOSTNAME*";
  .port = "80";
  .connect_timeout = 300s;
  .first_byte_timeout = 300s;
  .between_bytes_timeout = 300s;
}

This doesn't work. It tried using the std.get_env() function but it doesn't
work in this context.

*Is there any way to use environment variables in VCL, or do I have to
create a configuration template?*

Thanks for your help,

Cheers,
-Hugues
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://www.varnish-cache.org/lists/pipermail/varnish-misc/attachments/20190909/d6b32685/attachment-0001.html>


More information about the varnish-misc mailing list