Skip to content

Commit

Permalink
Change endpoint from /hooks to /events. Fixes runatlantis#22
Browse files Browse the repository at this point in the history
  • Loading branch information
Luke Kysow authored and lkysow committed Jul 2, 2017
1 parent 0384a09 commit 3187477
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 6 deletions.
1 change: 0 additions & 1 deletion cmd/server.go
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,6 @@ const (
logLevelFlag = "log-level"
portFlag = "port"
requireApprovalFlag = "require-approval"
sshKeyFlag = "ssh-key"
)

var stringFlags = []stringFlag{
Expand Down
4 changes: 2 additions & 2 deletions e2e/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -38,8 +38,8 @@ func main() {
if atlantisURL == "" {
atlantisURL = defaultAtlantisURL
}
// add /hooks to the url
atlantisURL = fmt.Sprintf("%s/hooks", atlantisURL)
// add /events to the url
atlantisURL = fmt.Sprintf("%s/events", atlantisURL)
ownerName := os.Getenv("GITHUB_REPO_OWNER_NAME")
if ownerName == "" {
ownerName = "anubhavmishra"
Expand Down
6 changes: 3 additions & 3 deletions server/server.go
Original file line number Diff line number Diff line change
Expand Up @@ -213,7 +213,7 @@ func (s *Server) Start() error {
return r.URL.Path == "/" || r.URL.Path == "/index.html"
})
s.router.PathPrefix("/static/").Handler(http.FileServer(&assetfs.AssetFS{Asset: Asset, AssetDir: AssetDir, AssetInfo: AssetInfo}))
s.router.HandleFunc("/hooks", s.postHooks).Methods("POST")
s.router.HandleFunc("/events", s.postEvents).Methods("POST")
s.router.HandleFunc("/locks", s.deleteLock).Methods("DELETE").Queries("id", "{id:.*}")
lockRoute := s.router.HandleFunc("/lock", s.lock).Methods("GET").Queries("id", "{id}").Name(lockRoute)
// function that planExecutor can use to construct detail view url
Expand Down Expand Up @@ -334,8 +334,8 @@ func (s *Server) deleteLock(w http.ResponseWriter, r *http.Request) {
fmt.Fprint(w, "Unlocked successfully")
}

// postHooks handles comment and pull request events from GitHub
func (s *Server) postHooks(w http.ResponseWriter, r *http.Request) {
// postEvents handles comment and pull request events from GitHub
func (s *Server) postEvents(w http.ResponseWriter, r *http.Request) {
githubReqID := "X-Github-Delivery=" + r.Header.Get("X-Github-Delivery")

var payload []byte
Expand Down

0 comments on commit 3187477

Please sign in to comment.