Skip to content

Commit

Permalink
fix: add logs
Browse files Browse the repository at this point in the history
  • Loading branch information
Mahanmmi committed Dec 18, 2024
1 parent 8eb1ae3 commit 22acaf9
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions pkg/cloudql/sdk/extra/rego/http.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ package rego
import (
"github.com/labstack/echo/v4"
"github.com/open-policy-agent/opa/rego"
"go.uber.org/zap"
)

type RegoEvaluateRequest struct {
Expand All @@ -26,11 +27,15 @@ type RegoEvaluateResponse struct {
func (r *RegoEngine) evaluateEndpoint(c echo.Context) error {
req := new(RegoEvaluateRequest)
if err := c.Bind(req); err != nil {
r.logger.Error("Unable to bind request", zap.Error(err))
r.logger.Sync()
return err
}

results, err := r.evaluate(c.Request().Context(), req.Policies, req.Query)
if err != nil {
r.logger.Error("Unable to evaluate rego", zap.Error(err))
r.logger.Sync()
return err
}

Expand Down

0 comments on commit 22acaf9

Please sign in to comment.