registerGithubEndpoints registers the non-gRPC endpoints for the Github integration.
(mux *http.ServeMux)
| 504 | |
| 505 | // registerGithubEndpoints registers the non-gRPC endpoints for the Github integration. |
| 506 | func (s *Server) registerGithubEndpoints(mux *http.ServeMux) { |
| 507 | // TODO: Add helper utils to clean this up |
| 508 | inner := http.NewServeMux() |
| 509 | observability.MuxHandle(inner, "/github/webhook", http.HandlerFunc(s.githubWebhook)) |
| 510 | observability.MuxHandle(inner, "/github/connect", s.authenticator.HTTPMiddleware(middleware.Check(s.checkGithubRateLimit("/github/connect"), http.HandlerFunc(s.githubConnect)))) |
| 511 | observability.MuxHandle(inner, "/github/connect/callback", s.authenticator.HTTPMiddleware(middleware.Check(s.checkGithubRateLimit("/github/connect/callback"), http.HandlerFunc(s.githubConnectCallback)))) |
| 512 | observability.MuxHandle(inner, "/github/auth/login", s.authenticator.HTTPMiddleware(middleware.Check(s.checkGithubRateLimit("github/auth/login"), http.HandlerFunc(s.githubAuth)))) |
| 513 | observability.MuxHandle(inner, "/github/auth/callback", s.authenticator.HTTPMiddleware(middleware.Check(s.checkGithubRateLimit("github/auth/callback"), http.HandlerFunc(s.githubAuthCallback)))) |
| 514 | observability.MuxHandle(inner, "/github/post-auth-redirect", s.authenticator.HTTPMiddleware(middleware.Check(s.checkGithubRateLimit("github/post-auth-redirect"), http.HandlerFunc(s.githubStatus)))) |
| 515 | mux.Handle("/github/", observability.Middleware("admin", s.logger, inner)) |
| 516 | } |
| 517 | |
| 518 | type githubConnectState struct { |
| 519 | Remote string `json:"remote"` |
no test coverage detected