install.go 635 B

12345678910111213141516171819202122232425
  1. package gitinstallation
  2. import (
  3. "fmt"
  4. "net/http"
  5. "github.com/porter-dev/porter/api/server/handlers"
  6. "github.com/porter-dev/porter/api/server/shared/config"
  7. )
  8. type GithubAppInstallHandler struct {
  9. handlers.PorterHandler
  10. }
  11. func NewGithubAppInstallHandler(
  12. config *config.Config,
  13. ) *GithubAppInstallHandler {
  14. return &GithubAppInstallHandler{
  15. PorterHandler: handlers.NewDefaultPorterHandler(config, nil, nil),
  16. }
  17. }
  18. func (c *GithubAppInstallHandler) ServeHTTP(w http.ResponseWriter, r *http.Request) {
  19. http.Redirect(w, r, fmt.Sprintf("https://github.com/apps/%s/installations/new", c.Config().GithubAppConf.AppName), 302)
  20. }