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