Deep copy config for sanitization

This commit is contained in:
2025-11-14 20:25:40 +01:00
parent 09605d07ab
commit e77ed0cdef
2 changed files with 26 additions and 6 deletions

View File

@@ -32,8 +32,11 @@ func (h *Handler) VersionHandler() http.HandlerFunc {
// @Router /api/v1/config [get]
func (h *Handler) ConfigHandler() http.HandlerFunc {
return func(w http.ResponseWriter, r *http.Request) {
// Return a sanitized copy of the configuration
sanitizedConfig := h.cfg.SanitizedCopy()
sanitizedConfig, err := h.cfg.SanitizedCopy()
if err != nil {
writeError(w, http.StatusInternalServerError, "sanitized_copy_error", "Failed to get sanitized config")
return
}
writeJSON(w, http.StatusOK, sanitizedConfig)
}
}