this repo has no description

all: minor fixes

Changed files
+12 -10
appview
state
knotserver
+6 -2
appview/state/state.go
··· 122 log.Println("has secret ", secret) 123 124 // make a request do the knotserver with an empty body and above signature 125 - url := fmt.Sprintf("http://%s/internal/health", domain) 126 127 pingRequest, err := buildPingRequest(url, secret) 128 if err != nil { ··· 164 w.Write([]byte("check success")) 165 166 // mark as registered 167 - s.Db.Register(domain) 168 169 return 170 }
··· 122 log.Println("has secret ", secret) 123 124 // make a request do the knotserver with an empty body and above signature 125 + url := fmt.Sprintf("http://%s/health", domain) 126 127 pingRequest, err := buildPingRequest(url, secret) 128 if err != nil { ··· 164 w.Write([]byte("check success")) 165 166 // mark as registered 167 + err = s.Db.Register(domain) 168 + if err != nil { 169 + log.Println("failed to register domain", err) 170 + http.Error(w, err.Error(), http.StatusInternalServerError) 171 + } 172 173 return 174 }
+5 -7
knotserver/handler.go
··· 17 db: db, 18 } 19 20 - r.Route("/settings", func(r chi.Router) { 21 - r.Get("/keys", h.Keys) 22 - r.Put("/keys", h.Keys) 23 - }) 24 - 25 r.Get("/", h.Index) 26 r.Route("/{did}", func(r chi.Router) { 27 // Repo routes ··· 49 r.Put("/new", h.NewRepo) 50 }) 51 52 - r.Route("/internal", func(r chi.Router) { 53 r.Use(h.VerifySignature) 54 - r.Get("/health", h.Health) 55 }) 56 57 return r, nil
··· 17 db: db, 18 } 19 20 r.Get("/", h.Index) 21 r.Route("/{did}", func(r chi.Router) { 22 // Repo routes ··· 44 r.Put("/new", h.NewRepo) 45 }) 46 47 + r.With(h.VerifySignature).Get("/health", h.Health) 48 + 49 + r.Group(func(r chi.Router) { 50 r.Use(h.VerifySignature) 51 + r.Get("/keys", h.Keys) 52 + r.Put("/keys", h.Keys) 53 }) 54 55 return r, nil
+1 -1
knotserver/routes.go
··· 393 394 func (h *Handle) Health(w http.ResponseWriter, r *http.Request) { 395 log.Println("got health check") 396 - mac := hmac.New(sha256.New, []byte(h.c.Secret)) 397 mac.Write([]byte("ok")) 398 w.Header().Add("X-Signature", hex.EncodeToString(mac.Sum(nil))) 399
··· 393 394 func (h *Handle) Health(w http.ResponseWriter, r *http.Request) { 395 log.Println("got health check") 396 + mac := hmac.New(sha256.New, []byte(h.c.Server.Secret)) 397 mac.Write([]byte("ok")) 398 w.Header().Add("X-Signature", hex.EncodeToString(mac.Sum(nil))) 399