mirror of
https://github.com/1f349/daisy.git
synced 2025-02-22 13:35:00 +00:00
Move middleware to allow GET /health to work without authentication
This commit is contained in:
parent
d48dec6125
commit
8c5145849b
12
server.go
12
server.go
@ -76,12 +76,12 @@ func NewHttpServer(conf Conf, wd string) *http.Server {
|
|||||||
}
|
}
|
||||||
|
|
||||||
r := http.NewServeMux()
|
r := http.NewServeMux()
|
||||||
r.Handle("/", handler)
|
r.Handle("/", principle.Middleware(handler))
|
||||||
r.Handle("GET /ok", http.HandlerFunc(func(rw http.ResponseWriter, _ *http.Request) {
|
r.Handle("GET /health", http.HandlerFunc(func(rw http.ResponseWriter, _ *http.Request) {
|
||||||
http.Error(rw, "Daisy API Endpoint", http.StatusOK)
|
http.Error(rw, "Health OK", http.StatusOK)
|
||||||
}))
|
}))
|
||||||
r.Handle("/.well-known/carddav", cardHandler)
|
r.Handle("/.well-known/carddav", principle.Middleware(cardHandler))
|
||||||
r.Handle("/{user}/contacts/", cardHandler)
|
r.Handle("/{user}/contacts/", principle.Middleware(cardHandler))
|
||||||
|
|
||||||
r2 := http.HandlerFunc(func(rw http.ResponseWriter, req *http.Request) {
|
r2 := http.HandlerFunc(func(rw http.ResponseWriter, req *http.Request) {
|
||||||
t := time.Now()
|
t := time.Now()
|
||||||
@ -92,7 +92,7 @@ func NewHttpServer(conf Conf, wd string) *http.Server {
|
|||||||
|
|
||||||
return &http.Server{
|
return &http.Server{
|
||||||
Addr: conf.Listen,
|
Addr: conf.Listen,
|
||||||
Handler: principle.Middleware(r2),
|
Handler: r2,
|
||||||
ReadTimeout: time.Minute,
|
ReadTimeout: time.Minute,
|
||||||
ReadHeaderTimeout: time.Minute,
|
ReadHeaderTimeout: time.Minute,
|
||||||
WriteTimeout: time.Minute,
|
WriteTimeout: time.Minute,
|
||||||
|
Loading…
x
Reference in New Issue
Block a user