Skip to content

Commit

Permalink
fix(runners): use correct middleware
Browse files Browse the repository at this point in the history
  • Loading branch information
fiftin committed Nov 17, 2024
1 parent 14d893d commit d32bda2
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 9 deletions.
13 changes: 5 additions & 8 deletions api/projects/runners.go
Original file line number Diff line number Diff line change
@@ -1,10 +1,13 @@
//go:build !pro

package projects

import (
"net/http"

"github.com/gorilla/context"
"github.com/semaphoreui/semaphore/api/helpers"
"github.com/semaphoreui/semaphore/db"
"net/http"
)

func GetRunners(w http.ResponseWriter, r *http.Request) {
Expand All @@ -15,13 +18,7 @@ func GetRunners(w http.ResponseWriter, r *http.Request) {
panic(err)
}

var result = make([]db.Runner, 0)

for _, runner := range runners {
result = append(result, runner)
}

helpers.WriteJSON(w, http.StatusOK, result)
helpers.WriteJSON(w, http.StatusOK, runners)
}

func AddRunner(w http.ResponseWriter, r *http.Request) {
Expand Down
2 changes: 1 addition & 1 deletion api/router.go
Original file line number Diff line number Diff line change
Expand Up @@ -226,7 +226,7 @@ func Route() *mux.Router {
projectUserAPI.Path("/runners").HandlerFunc(projects.AddRunner).Methods("POST")

projectRunnersAPI := projectUserAPI.PathPrefix("/runners").Subrouter()
projectRunnersAPI.Use(globalRunnerMiddleware)
projectRunnersAPI.Use(projects.RunnerMiddleware)
projectRunnersAPI.Path("/{runner_id}").HandlerFunc(projects.GetRunner).Methods("GET", "HEAD")
projectRunnersAPI.Path("/{runner_id}").HandlerFunc(projects.UpdateRunner).Methods("PUT", "POST")
projectRunnersAPI.Path("/{runner_id}/active").HandlerFunc(projects.SetRunnerActive).Methods("POST")
Expand Down

0 comments on commit d32bda2

Please sign in to comment.