here is my simple listen
section of the haproxy config file:
listen graph_front
bind *:8182
mode tcp
server graph_server graph.server.com:8182
this works just fine, but I need the address and port to be a environment variable. So I changed it to this:
listen graph_front
bind *:8182
mode tcp
server graph_server "$GRAPH_ADDRESS":"$GRAPH_PORT"
the haproxy server restarts just fine, but it no longer forwards to the address in the environment variables.
any ideas?
The above config was fine. It was the way I was starting haproxy. I have to start it directly with
haproxy -f /path/to/config
this will not work with out elevated privileges. So, next
sudo haproxy -f /path/to/config
of course the env variables are not passed through sudo. So a more direct way like this works:
sudo -- sh -c 'export GRAPH_ADDRESS=graph.server.com; export GRAPH_PORT=8182; haproxy -f /etc/haproxy/haproxy.cfg