mirror of
https://code.tvl.fyi/depot.git:/tools/nixery.git
synced 2025-03-15 22:21:52 +00:00
fix(go): Registry API acknowledgement URI has a trailing slash
Previously the acknowledgement calls from Docker were receiving a 404 (which apparently doesn't bother it?!). This corrects the URL, which meant that acknowledgement had to move inside of the registryHandler.
This commit is contained in:
parent
18ef0d56fd
commit
f2d272b835
12
main.go
12
main.go
|
@ -367,6 +367,11 @@ type registryHandler struct {
|
||||||
}
|
}
|
||||||
|
|
||||||
func (h *registryHandler) ServeHTTP(w http.ResponseWriter, r *http.Request) {
|
func (h *registryHandler) ServeHTTP(w http.ResponseWriter, r *http.Request) {
|
||||||
|
// Acknowledge that we speak V2 with an empty response
|
||||||
|
if r.RequestURI == "/v2/" {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
// Serve the manifest (straight from Nix)
|
// Serve the manifest (straight from Nix)
|
||||||
manifestMatches := manifestRegex.FindStringSubmatch(r.RequestURI)
|
manifestMatches := manifestRegex.FindStringSubmatch(r.RequestURI)
|
||||||
if len(manifestMatches) == 3 {
|
if len(manifestMatches) == 3 {
|
||||||
|
@ -436,12 +441,7 @@ func main() {
|
||||||
|
|
||||||
log.Printf("Starting Kubernetes Nix controller on port %s\n", cfg.port)
|
log.Printf("Starting Kubernetes Nix controller on port %s\n", cfg.port)
|
||||||
|
|
||||||
// Acknowledge that we speak V2
|
// All /v2/ requests belong to the registry handler.
|
||||||
http.HandleFunc("/v2", func(w http.ResponseWriter, r *http.Request) {
|
|
||||||
fmt.Fprintln(w)
|
|
||||||
})
|
|
||||||
|
|
||||||
// All other /v2/ requests belong to the registry handler.
|
|
||||||
http.Handle("/v2/", ®istryHandler{
|
http.Handle("/v2/", ®istryHandler{
|
||||||
cfg: cfg,
|
cfg: cfg,
|
||||||
ctx: &ctx,
|
ctx: &ctx,
|
||||||
|
|
Loading…
Reference in New Issue
Block a user