refactor: export SanitizeTail and DefaultLogTail directly instead of wrapping

- Rename sanitizeTail → SanitizeTail (exported)
- Rename defaultLogTail → DefaultLogTail (exported)
- Delete export_test.go (no longer needed)
- Update test to reference handlers.SanitizeTail/DefaultLogTail directly
This commit is contained in:
user
2026-02-15 22:14:12 -08:00
parent 69a5a8c298
commit a80b7ac0a6
3 changed files with 14 additions and 23 deletions

View File

@@ -382,22 +382,22 @@ func (h *Handlers) HandleAppDeployments() http.HandlerFunc {
}
}
// defaultLogTail is the default number of log lines to fetch.
const defaultLogTail = "500"
// DefaultLogTail is the default number of log lines to fetch.
const DefaultLogTail = "500"
// maxLogTail is the maximum allowed value for the tail parameter.
const maxLogTail = 500
// sanitizeTail validates and clamps the tail query parameter.
// SanitizeTail validates and clamps the tail query parameter.
// It returns a numeric string clamped to maxLogTail, or the default if invalid.
func sanitizeTail(raw string) string {
func SanitizeTail(raw string) string {
if raw == "" {
return defaultLogTail
return DefaultLogTail
}
n, err := strconv.Atoi(raw)
if err != nil || n < 1 {
return defaultLogTail
return DefaultLogTail
}
if n > maxLogTail {
@@ -428,7 +428,7 @@ func (h *Handlers) HandleAppLogs() http.HandlerFunc {
return
}
tail := sanitizeTail(request.URL.Query().Get("tail"))
tail := SanitizeTail(request.URL.Query().Get("tail"))
logs, logsErr := h.docker.ContainerLogs(
request.Context(),