mirror of
https://codeberg.org/git-pages/git-pages.git
synced 2026-05-14 03:01:48 +00:00
[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:
@@ -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"
|
||||
|
||||
@@ -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 {
|
||||
|
||||
@@ -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)
|
||||
}
|
||||
}
|
||||
@@ -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 {
|
||||
|
||||
Reference in New Issue
Block a user