[breaking-change] Remove health endpoint handler and renumber metrics.

The previous commit has eliminated any way to use `ServeHealth()`,
but kept it around to not introduce breaking changes. This one has
no such constraint.
This commit is contained in:
Catherine
2025-09-23 02:36:23 +00:00
parent 4c087278cb
commit fc029ad219
4 changed files with 2 additions and 26 deletions

View File

@@ -7,8 +7,7 @@ log-format = "datetime+message"
# Use "-" to disable the handler.
pages = "tcp/:3000"
caddy = "tcp/:3001"
health = "tcp/:3002"
metrics = "tcp/:3003"
metrics = "tcp/:3002"
[[wildcard]] # non-default section
domain = "codeberg.page"

View File

@@ -47,8 +47,7 @@ type Config struct {
type ServerConfig struct {
Pages string `toml:"pages" default:"tcp/:3000"`
Caddy string `toml:"caddy" default:"tcp/:3001"`
Health string `toml:"health" default:"tcp/:3002"`
Metrics string `toml:"metrics" default:"tcp/:3003"`
Metrics string `toml:"metrics" default:"tcp/:3002"`
}
type WildcardConfig struct {

View File

@@ -1,20 +0,0 @@
package main
import (
"fmt"
"net/http"
)
func ServeHealth(w http.ResponseWriter, r *http.Request) {
switch r.URL.Path {
case "/":
w.WriteHeader(http.StatusOK)
fmt.Fprintln(w, "ok")
case "/panic":
panic("explicit panic request")
default:
http.Error(w, "not found", http.StatusNotFound)
}
}

View File

@@ -168,7 +168,6 @@ func main() {
// just 0.5s later.
pagesListener := listen("pages", config.Server.Pages)
caddyListener := listen("caddy", config.Server.Caddy)
healthListener := listen("health", config.Server.Health)
metricsListener := listen("metrics", config.Server.Metrics)
if err := ConfigureBackend(&config.Storage); err != nil {
@@ -181,7 +180,6 @@ func main() {
go serve(pagesListener, http.HandlerFunc(ServePages))
go serve(caddyListener, http.HandlerFunc(ServeCaddy))
go serve(healthListener, http.HandlerFunc(ServeHealth))
go serve(metricsListener, promhttp.Handler())
if config.Insecure {