Files
miti99bot/internal/server/router.go
T
tiennm99 5bfee58964 refactor(server): drop HTTP /cron route; run crons in-process only
The in-process scheduler is the sole cron trigger on self-host, so the
/cron/{name} HTTP endpoint and its CRON_SHARED_SECRET are dead surface.
Reduce the HTTP server to GET / (health) and remove the cron secret config,
SSM binding, and now-unused timeout.
2026-06-28 22:15:04 +07:00

20 lines
697 B
Go

package server
import "net/http"
// New builds the application's HTTP handler. The only route is:
//
// GET / → health (Coolify container monitor; not publicly routed)
//
// There is no /webhook route: Telegram updates arrive via long polling
// (cmd/server runs b.Start), so the bot needs no public inbound ingress.
// There is no /cron route either: crons fire from the in-process scheduler
// (internal/cron), so cron has no HTTP surface to expose or protect.
// Anything else is 404. All routes pass through LogRequests so every request
// emits a structured `req` log line.
func New() http.Handler {
mux := http.NewServeMux()
mux.Handle("/", HealthHandler())
return LogRequests(mux)
}