No. Sudo doesn't pass envvars through to its children by default: https://stackoverflow.com/questions/8633461/how-to-keep-environment-variables-when-using-sudo
Read that page *and* the comments - in particular be aware that you have to request (at the CLI) that sudo preserve envvars, and you also have to have been granted permission to do this, via the sudoers config file. If this is all sounding a bit complicated, that's because it is. You've chosen a relatively uncommon way of running haproxy - directly, via sudo. Consider running via an init script or systemd unit (?) or, failing that, just a script which is itself the sudo target, which sets the envvars in the privileged environment. J On Sat, 21 Jul 2018 at 17:31, jdtommy <jdto...@gmail.com> wrote: > would this chain of calls not work? > > ubuntu@ip-172-31-30-4:~$ export GRAPH_ADDRESS=graph.server.com > ubuntu@ip-172-31-30-4:~$ export GRAPH_PORT=8182 > ubuntu@ip-172-31-30-4:~$ sudo haproxy -d -V -f /etc/haproxy/haproxy.cfg > > On Sat, Jul 21, 2018 at 3:26 AM Igor Cicimov < > ig...@encompasscorporation.com> wrote: > >> On Sat, Jul 21, 2018 at 7:12 PM, Jonathan Matthews < >> cont...@jpluscplusm.com> wrote: >> >>> On Sat, 21 Jul 2018 at 09:12, jdtommy <jdto...@gmail.com> wrote: >>> >>>> I am setting them before I start haproxy in the terminal. I tried both >>>> starting it as a service and starting directly, but neither worked. It >>>> still would not forward it along. >>>> >>> >>> Make sure that, as well as setting them, you're *exporting* the envvars >>> before asking a child process (i.e. haproxy) to use them. >>> >>> J >>> -- >>> Jonathan Matthews >>> London, UK >>> http://www.jpluscplusm.com/contact.html >>> >> >> As Jonathan said, plus make sure they are included/exported in the init >> script or systemd file for the service. >> >> > > -- > Jarad Duersch > -- Jonathan Matthews London, UK http://www.jpluscplusm.com/contact.html