Add some more debug logging to register-servers, found the issue

This commit is contained in:
Thomas Lynch
2023-09-02 22:18:04 +10:00
parent c28e4d438e
commit 2e2e532ea8

View File

@ -24,14 +24,17 @@ function setup_servers()
tcp:connect("127.0.0.1", 2000); --TODO: configurable port tcp:connect("127.0.0.1", 2000); --TODO: configurable port
while line do while line do
local domain, backend_host = line:match("([^%s]+)%s+([^%s]+)") local domain, backend_host = line:match("([^%s]+)%s+([^%s]+)")
print("reading line hosts.map: domain="..domain..",backend_host="..backend_host)
local new_map_value = server_prefix..counter local new_map_value = server_prefix..counter
local existing_map_value = backends_map:lookup(domain) local existing_map_value = backends_map:lookup(domain)
if existing_map_value ~= nil then if existing_map_value ~= nil then
print("existing_map_value: "..existing_map_value)
current_backends = utils.split(existing_map_value, ",") current_backends = utils.split(existing_map_value, ",")
if not utils.contains(current_backends, new_map_value) then if not utils.contains(current_backends, new_map_value) then
new_map_value = new_map_value .. "," .. existing_map_value new_map_value = new_map_value .. "," .. existing_map_value
end end
end end
print("setting entry hosts.map: domain="..domain..",new_map_value="..new_map_value)
core.set_map("/etc/haproxy/map/backends.map", domain, new_map_value) core.set_map("/etc/haproxy/map/backends.map", domain, new_map_value)
local server_name = "servers/websrv"..counter local server_name = "servers/websrv"..counter
--NOTE: if you have a proper CA setup, --NOTE: if you have a proper CA setup,