Rename websocket URLs
Given that we now have multiple websocket URLs (logs and events), this change categorizes them under the same prefix. Signed-off-by: Gabriel Adrian Samfira <gsamfira@cloudbasesolutions.com>
This commit is contained in:
parent
7fe2a3ad34
commit
79c1e47427
3 changed files with 14 additions and 5 deletions
|
|
@ -411,9 +411,18 @@ func NewAPIRouter(han *controllers.APIController, authMiddleware, initMiddleware
|
|||
apiRouter.Handle("/github/credentials/{id}/", http.HandlerFunc(han.UpdateGithubCredential)).Methods("PUT", "OPTIONS")
|
||||
apiRouter.Handle("/github/credentials/{id}", http.HandlerFunc(han.UpdateGithubCredential)).Methods("PUT", "OPTIONS")
|
||||
|
||||
// Websocket log writer
|
||||
apiRouter.Handle("/{ws:ws\\/?}", http.HandlerFunc(han.WSHandler)).Methods("GET")
|
||||
apiRouter.Handle("/{events:events\\/?}", http.HandlerFunc(han.EventsHandler)).Methods("GET")
|
||||
/////////////////////////
|
||||
// Websocket endpoints //
|
||||
/////////////////////////
|
||||
// Legacy log websocket path
|
||||
apiRouter.Handle("/ws/", http.HandlerFunc(han.WSHandler)).Methods("GET")
|
||||
apiRouter.Handle("/ws", http.HandlerFunc(han.WSHandler)).Methods("GET")
|
||||
// Log websocket endpoint
|
||||
apiRouter.Handle("/ws/logs/", http.HandlerFunc(han.WSHandler)).Methods("GET")
|
||||
apiRouter.Handle("/ws/logs", http.HandlerFunc(han.WSHandler)).Methods("GET")
|
||||
// DB watcher websocket endpoint
|
||||
apiRouter.Handle("/ws/events/", http.HandlerFunc(han.EventsHandler)).Methods("GET")
|
||||
apiRouter.Handle("/ws/events", http.HandlerFunc(han.EventsHandler)).Methods("GET")
|
||||
|
||||
// NotFound handler
|
||||
apiRouter.PathPrefix("/").HandlerFunc(han.NotFoundHandler).Methods("GET", "POST", "PUT", "DELETE", "OPTIONS")
|
||||
|
|
|
|||
|
|
@ -27,7 +27,7 @@ var eventsCmd = &cobra.Command{
|
|||
ctx, stop := signal.NotifyContext(context.Background(), signals...)
|
||||
defer stop()
|
||||
|
||||
reader, err := garmWs.NewReader(ctx, mgr.BaseURL, "/api/v1/events", mgr.Token, common.PrintWebsocketMessage)
|
||||
reader, err := garmWs.NewReader(ctx, mgr.BaseURL, "/api/v1/ws/events", mgr.Token, common.PrintWebsocketMessage)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
|
|
|||
|
|
@ -21,7 +21,7 @@ var logCmd = &cobra.Command{
|
|||
ctx, stop := signal.NotifyContext(context.Background(), signals...)
|
||||
defer stop()
|
||||
|
||||
reader, err := garmWs.NewReader(ctx, mgr.BaseURL, "/api/v1/ws", mgr.Token, common.PrintWebsocketMessage)
|
||||
reader, err := garmWs.NewReader(ctx, mgr.BaseURL, "/api/v1/ws/logs", mgr.Token, common.PrintWebsocketMessage)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue