Skip to content

Commit

Permalink
Merge pull request #2323 from opengovern/fix-tasks
Browse files Browse the repository at this point in the history
fix: add default values to named queries run
  • Loading branch information
artaasadi authored Dec 28, 2024
2 parents 4a9812a + b2908ae commit 946bcce
Showing 1 changed file with 13 additions and 1 deletion.
14 changes: 13 additions & 1 deletion services/inventory/http_routes.go
Original file line number Diff line number Diff line change
Expand Up @@ -1157,7 +1157,19 @@ func (h *HttpHandler) RunQueryByID(ctx echo.Context) error {
engine = inventoryApi.QueryEngine(engineStr)
}

queryParamMap := req.QueryParams
queryParams, err := h.metadataClient.ListQueryParameters(&httpclient.Context{UserRole: api.AdminRole})
if err != nil {
h.logger.Error("failed to get query parameters", zap.Error(err))
return echo.NewHTTPError(http.StatusInternalServerError, "failed to get query parameters")
}
queryParamMap := make(map[string]string)
for _, qp := range queryParams.QueryParameters {
queryParamMap[qp.Key] = qp.Value
}

for k, v := range req.QueryParams {
queryParamMap[k] = v
}

queryTemplate, err := template.New("query").Parse(query)
if err != nil {
Expand Down

0 comments on commit 946bcce

Please sign in to comment.