fix(haproxy-stats): add stats socket to template + fix safeAt index-0 bug
Two root causes for Dashboard backends not showing: 1. haproxy.cfg.tpl had no stats socket directive → /run/haproxy/admin.sock never created → handler got "connection refused" → empty array returned. Fixed: added stats socket /run/haproxy/admin.sock mode 0660 level admin. 2. safeAt() used i<=0 instead of i<0 → pxname (column 0) always returned "" → all backend names were empty in the API response. After upgrade: HAProxy reload (triggered by any domain/backend save, or edgeguard-ctl render-config) will create the socket. v1.1.113. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -135,7 +135,7 @@ func (h *HAProxyStatsHandler) Stats(c *gin.Context) {
|
||||
}
|
||||
|
||||
func safeAt(fields []string, i int) string {
|
||||
if i <= 0 || i >= len(fields) {
|
||||
if i < 0 || i >= len(fields) {
|
||||
return ""
|
||||
}
|
||||
return fields[i]
|
||||
|
||||
Reference in New Issue
Block a user