Conditional lua-load in the haproxy.cfg file

I am trying to let haproxy access my letsencrypt ssl certs easier.

I am using haproxy 1.8 ( octopi setup )

I added a lua-load command to my global config section in my haproxy.cfg file. I used:
lua-load <path_to>/update_haproxy_ssl_certs.lua
and that lua script copies / merges the required ssl certs from my /etc/letsencrypt directory to the place / file that haproxy wants.

That all works great.

My question / issue is… can I have that lua-load command there and NOT fail if the file it wants to load does not exists. Can I have some sort of:

if file_exists(<path_to>/update_haproxy_ssl_certs.lua) {
lua-load <path_to>/update_haproxy_ssl_certs.lua
lua-load-if-file-exists <path_to>/update_haproxy_ssl_certs.lua

The haproxy.cfg file is copied to multiple servers… but they don’t all have the letsencrypt ssl certs.

  • thanks - jack

No, this is not possible. You need to automate this yourself.