91b49cb5ed
- Expand health endpoint to check DB, Docker, and NPM connectivity (FUNC-M4) - Add project_id, stage_id, offset query params to deploys endpoint (FUNC-M5, FUNC-M6) - Add notification_url field to Stage model for per-project overrides (FUNC-M2) - Add NPM Ping method for health checking - Sanitize all internal error messages in API handlers (SEC-M4) - Add audit trail events for admin actions (FUNC-M3) - Add EventLog event type to event bus
24 lines
644 B
Go
24 lines
644 B
Go
package api
|
|
|
|
import (
|
|
"log/slog"
|
|
"net/http"
|
|
|
|
"github.com/alexei/docker-watcher/internal/config"
|
|
)
|
|
|
|
// exportConfig handles GET /api/config/export — downloads current state as YAML.
|
|
func (s *Server) exportConfig(w http.ResponseWriter, r *http.Request) {
|
|
data, err := config.ExportConfig(s.store)
|
|
if err != nil {
|
|
slog.Error("failed to export config", "error", err)
|
|
respondError(w, http.StatusInternalServerError, "internal server error")
|
|
return
|
|
}
|
|
|
|
w.Header().Set("Content-Type", "application/x-yaml")
|
|
w.Header().Set("Content-Disposition", "attachment; filename=docker-watcher.yaml")
|
|
w.WriteHeader(http.StatusOK)
|
|
w.Write(data)
|
|
}
|