From c6028b6951af800ec11fce720dcdc1c7f820ed3f Mon Sep 17 00:00:00 2001 From: enzo Date: Sat, 21 Mar 2026 00:39:19 +0100 Subject: [PATCH] =?UTF-8?q?fix:=20proxmox=20client=20relit=20la=20config?= =?UTF-8?q?=20DB=20=C3=A0=20chaque=20requ=C3=AAte=20(token=20update=20sans?= =?UTF-8?q?=20red=C3=A9marrage)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-Authored-By: Claude Sonnet 4.6 --- backend/internal/api/proxmox.go | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) diff --git a/backend/internal/api/proxmox.go b/backend/internal/api/proxmox.go index c199e06..a74fd02 100644 --- a/backend/internal/api/proxmox.go +++ b/backend/internal/api/proxmox.go @@ -58,16 +58,14 @@ func (h *ProxmoxHandler) initClient() { log.Printf("[proxmox/init] Impossible de déchiffrer le token : %v", err) return } - log.Printf("[proxmox/init] Client initialisé — url=%s", url) h.client = proxmox.NewClient(url, token) } // GetResources retourne la liste de toutes les ressources Proxmox (LXC + VM + nodes). // GET /api/proxmox/resources func (h *ProxmoxHandler) GetResources(w http.ResponseWriter, r *http.Request) { - if h.client == nil { - h.initClient() - } + // Toujours relire la config (prend en compte les mises à jour du token sans redémarrage) + h.initClient() if h.client == nil { JSONError(w, "Proxmox non configuré", http.StatusServiceUnavailable) return @@ -86,9 +84,7 @@ func (h *ProxmoxHandler) GetResources(w http.ResponseWriter, r *http.Request) { // GetLXC retourne uniquement les conteneurs LXC. // GET /api/proxmox/lxc func (h *ProxmoxHandler) GetLXC(w http.ResponseWriter, r *http.Request) { - if h.client == nil { - h.initClient() - } + h.initClient() if h.client == nil { JSONError(w, "Proxmox non configuré", http.StatusServiceUnavailable) return