diff options
| author | Xe Iaso <me@xeiaso.net> | 2024-06-08 10:49:18 -0400 |
|---|---|---|
| committer | Xe Iaso <me@xeiaso.net> | 2024-06-08 10:49:28 -0400 |
| commit | 2f9125d0cbe232dbb0dcd64eab33af356d5d615c (patch) | |
| tree | c9cbe2476e939d41db0319e23e2205f7b7a02960 /cmd/within.website/main.go | |
| parent | 92a2b4a91b9d57f5c54673f1228278ee21f5e4b1 (diff) | |
| download | x-2f9125d0cbe232dbb0dcd64eab33af356d5d615c.tar.xz x-2f9125d0cbe232dbb0dcd64eab33af356d5d615c.zip | |
cmd/within.website: fix use of http servemux, deploy to k8s
Signed-off-by: Xe Iaso <me@xeiaso.net>
Diffstat (limited to 'cmd/within.website/main.go')
| -rw-r--r-- | cmd/within.website/main.go | 16 |
1 files changed, 8 insertions, 8 deletions
diff --git a/cmd/within.website/main.go b/cmd/within.website/main.go index f7d20c5..8bb5c75 100644 --- a/cmd/within.website/main.go +++ b/cmd/within.website/main.go @@ -51,14 +51,14 @@ func (r Repo) LogValue() slog.Value { ) } -func (r Repo) RegisterHandlers(lg *slog.Logger) { +func (r Repo) RegisterHandlers(mux *http.ServeMux, lg *slog.Logger) { switch r.Kind { case "gitea": - http.Handle("/"+r.Repo, vanity.GogsHandler(*domain+"/"+r.Repo, r.Domain, r.User, r.Repo, "https")) - http.Handle("/"+r.Repo+"/", vanity.GogsHandler(*domain+"/"+r.Repo, r.Domain, r.User, r.Repo, "https")) + mux.Handle("/"+r.Repo, vanity.GogsHandler(*domain+"/"+r.Repo, r.Domain, r.User, r.Repo, "https")) + mux.Handle("/"+r.Repo+"/", vanity.GogsHandler(*domain+"/"+r.Repo, r.Domain, r.User, r.Repo, "https")) case "github": - http.Handle("/"+r.Repo, vanity.GitHubHandler(*domain+"/"+r.Repo, r.User, r.Repo, "https")) - http.Handle("/"+r.Repo+"/", vanity.GitHubHandler(*domain+"/"+r.Repo, r.User, r.Repo, "https")) + mux.Handle("/"+r.Repo, vanity.GitHubHandler(*domain+"/"+r.Repo, r.User, r.Repo, "https")) + mux.Handle("/"+r.Repo+"/", vanity.GitHubHandler(*domain+"/"+r.Repo, r.User, r.Repo, "https")) } lg.Debug("registered repo handler", "repo", r) } @@ -76,12 +76,12 @@ func main() { os.Exit(1) } + mux := http.NewServeMux() + for _, repo := range repos { - repo.RegisterHandlers(lg) + repo.RegisterHandlers(mux, lg) } - mux := http.NewServeMux() - xess.Mount(mux) mux.HandleFunc("/debug/varz", tsweb.VarzHandler) |
