Skip to content

Commit d846650

Browse files
committed
🏪 api/ssm: support reloading uPSK store
1 parent 1f3c5ad commit d846650

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

api/ssm/ssm.go

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,8 @@ func (sm *ServerManager) RegisterHandlers(register func(method string, path stri
5353
register(http.MethodGet, "/servers/{server}/users/{username}", sm.requireServerUsers(handleGetUser))
5454
register(http.MethodPatch, "/servers/{server}/users/{username}", sm.requireServerUsers(handleUpdateUser))
5555
register(http.MethodDelete, "/servers/{server}/users/{username}", sm.requireServerUsers(handleDeleteUser))
56+
57+
register(http.MethodPost, "/servers/{server}/reload-users", sm.requireServerUsers(handleReloadUsers))
5658
}
5759

5860
func (sm *ServerManager) handleListServers(w http.ResponseWriter, _ *http.Request) (int, error) {
@@ -166,3 +168,10 @@ func handleDeleteUser(w http.ResponseWriter, r *http.Request, ms Server) (int, e
166168
}
167169
return restapi.EncodeResponse(w, http.StatusNoContent, nil)
168170
}
171+
172+
func handleReloadUsers(w http.ResponseWriter, _ *http.Request, s Server) (int, error) {
173+
if err := s.CredentialManager.LoadFromFile(); err != nil {
174+
return restapi.EncodeResponse(w, http.StatusInternalServerError, StandardError{Message: err.Error()})
175+
}
176+
return restapi.EncodeResponse(w, http.StatusNoContent, nil)
177+
}

0 commit comments

Comments
 (0)