mirror of
https://github.com/muety/wakapi.git
synced 2023-08-10 21:12:56 +03:00
Add health endpoint.
This commit is contained in:
@ -18,9 +18,10 @@ import (
|
||||
)
|
||||
|
||||
type AuthenticateMiddleware struct {
|
||||
UserSrvc *services.UserService
|
||||
Cache *cache.Cache
|
||||
Initialized bool
|
||||
UserSrvc *services.UserService
|
||||
Cache *cache.Cache
|
||||
WhitelistPaths []string
|
||||
Initialized bool
|
||||
}
|
||||
|
||||
func (m *AuthenticateMiddleware) Init() {
|
||||
@ -35,6 +36,13 @@ func (m *AuthenticateMiddleware) Handle(w http.ResponseWriter, r *http.Request,
|
||||
m.Init()
|
||||
}
|
||||
|
||||
for _, p := range m.WhitelistPaths {
|
||||
if strings.HasPrefix(r.URL.Path, p) || r.URL.Path == p {
|
||||
next(w, r)
|
||||
return
|
||||
}
|
||||
}
|
||||
|
||||
var user *models.User
|
||||
var userKey string
|
||||
user, userKey, err := m.tryGetUserByPassword(r)
|
||||
|
Reference in New Issue
Block a user