fix: seven quick-win bug fixes across engine, server, TUI, CLI
1. Alertless monitors no longer spam error logs — triggerAlert returns early when alertID <= 0. 2. HTTP response body drained before close — enables connection reuse via keep-alive instead of fresh TCP+TLS per check. 3. /api/backup/export enforces GET — was the only endpoint accepting any HTTP method. 4. limitStr guards against max < 3 — prevents negative slice index panic on very narrow terminals. 5. Filter input accepts multibyte characters — len(msg.Runes) instead of len(msg.String()) for proper Unicode support. 6. Startup warning corrected — with no UPTOP_CLUSTER_SECRET, endpoints reject (401), not accept. Warning now says so. 7. UPTOP_KEYS file open failure logged — was silently swallowed, leaving operators with no admin seeded and no message.
This commit was merged in pull request #111.
This commit is contained in:
@@ -64,7 +64,7 @@ func Start(cfg ServerConfig, s store.Store, eng *monitor.Engine) *http.Server {
|
||||
|
||||
func (s *Server) Start() *http.Server {
|
||||
if s.cfg.ClusterKey == "" {
|
||||
slog.Warn("no UPTOP_CLUSTER_SECRET set, cluster API endpoints are unauthenticated")
|
||||
slog.Warn("no UPTOP_CLUSTER_SECRET set, cluster API endpoints will reject all requests")
|
||||
}
|
||||
|
||||
if s.cfg.ClusterMode != "" && s.cfg.ClusterMode != "leader" && s.cfg.TLSCert == "" {
|
||||
@@ -168,6 +168,10 @@ func (s *Server) handleHealth(w http.ResponseWriter, r *http.Request) {
|
||||
}
|
||||
|
||||
func (s *Server) handleExport(w http.ResponseWriter, r *http.Request) {
|
||||
if r.Method != http.MethodGet {
|
||||
http.Error(w, "Method not allowed", http.StatusMethodNotAllowed)
|
||||
return
|
||||
}
|
||||
if !s.requireAuth(r) {
|
||||
http.Error(w, "Unauthorized: UPTOP_CLUSTER_SECRET required", http.StatusUnauthorized)
|
||||
return
|
||||
|
||||
Reference in New Issue
Block a user