Skip to content

Commit

Permalink
perf: generate policy response on startup
Browse files Browse the repository at this point in the history
  • Loading branch information
peterhirn committed Feb 18, 2024
1 parent 15fd78d commit 5782223
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion main.go
Original file line number Diff line number Diff line change
Expand Up @@ -98,12 +98,14 @@ func policyResponse(policy Policy) string {
}

func handlePolicy(config Config) http.HandlerFunc {
response := policyResponse(config.Policy)

return func(w http.ResponseWriter, r *http.Request) {
if r.Method != http.MethodGet {
w.WriteHeader(http.StatusMethodNotAllowed)
return
}
fmt.Fprint(w, policyResponse(config.Policy))
fmt.Fprint(w, response)
}
}

Expand Down

0 comments on commit 5782223

Please sign in to comment.