How can I use environment variables in haproxy.conf
My haproxy.cfg file has one backend servers using hostnames:
backend servers
server myapp ${PORTAL_PORT_3000_TCP_ADDR}:${PORTAL_PORT_3000_TCP_PORT} maxconn 32
myapp is running in other docker container linked to haproxy docker container. The mentioned environment variable have values inside haproxy container but when it container start raise this error
[ALERT] 244/134924 (8) : parsing [/etc/haproxy.cfg:16] : Unknown host in '${PORTAL_PORT_3000_TCP_ADDR}:${PORTAL_PORT_3000_TCP_PORT}'
[ALERT] 244/134924 (8) : Error(s) found in configuration file : /etc/haproxy.cfg
[ALERT] 244/134934 (8) : Fatal errors found in configuration.
You are, most likely, using version 1.4 or older. The possibility to use environment variables has been introduced in haproxy 1.5.