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:
Debian
2026-05-27 07:36:31 +02:00
parent da554e9e82
commit 67c5180168
6 changed files with 8 additions and 5 deletions

View File

@@ -1 +1 @@
1.1.112
1.1.113

View File

@@ -60,7 +60,7 @@ import (
usersvc "git.netcell-it.de/projekte/edgeguard-native/internal/services/users"
)
var version = "1.1.112"
var version = "1.1.113"
func main() {
addr := os.Getenv("EDGEGUARD_API_ADDR")

View File

@@ -11,7 +11,7 @@ import (
"git.netcell-it.de/projekte/edgeguard-native/internal/services/setup"
)
var version = "1.1.112"
var version = "1.1.113"
const usage = `edgeguard-ctl — EdgeGuard CLI

View File

@@ -41,7 +41,7 @@ import (
"git.netcell-it.de/projekte/edgeguard-native/internal/services/tlscerts"
)
var version = "1.1.112"
var version = "1.1.113"
const (
// renewTickInterval — how often we re-evaluate expiring certs.

View File

@@ -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]

View File

@@ -15,6 +15,9 @@ global
# Ohne dieses Flag verweigert HAProxy `bind quic4@…` mit "this SSL
# library does not support the QUIC protocol".
limited-quic
# Runtime-API-Socket für edgeguard-api (show stat, show info, …).
# mode 0660 + group haproxy → edgeguard-user (in haproxy-group) kann lesen.
stats socket /run/haproxy/admin.sock mode 0660 level admin expose-fd listeners
defaults
log global