I am using the official varnish:6.5.1
docker image and have this vcl:
vcl 4.0;
import std;
backend default {
.host = std.getenv("PROXY_HOST");
.port = std.getenv("PROXY_PORT");
}
.....
When I try to run the image (with docker-compose) it instantly fails with this error:
varnish_1 | Could not delete 'vcl_boot.1612728251.581028/vgc.sym': No such file or directory
varnish_1 | Error:
varnish_1 | Message from VCC-compiler:
varnish_1 | Expected CSTR got 'std'
varnish_1 | (program line 369), at
varnish_1 | ('/etc/varnish/default.vcl' Line 13 Pos 17)
varnish_1 | .host = std.getenv("PROXY_HOST");
How is this failing? I would understand not being able to connect to the backend but the VCL parse should be fine, the documentation on the std VMOD is very simple for getenv
.
What am I missing here?
EDIT
backend default {
.host = "${PROXY_HOST}";
.port = "${PROXY_PORT}";
}
in combination with
#!/bin/bash
envs=`printenv`
for env in $envs
do
IFS== read name value <<< "$env"
sed -i "s|\${${name}}|${value}|g" /etc/varnish/default.vcl
done
varnishd -f /etc/varnish/default.vcl
works as per this post but that seems hardly optimal.