Skip to content
This repository has been archived by the owner on Sep 4, 2024. It is now read-only.

Commit

Permalink
Add the TOPIC_ID as env var in the request (#94)
Browse files Browse the repository at this point in the history
Take the field `topic`  and pass it as env var on the request.
  • Loading branch information
xmariachi authored Mar 22, 2024
1 parent 03484df commit df81074
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions cmd/node/execute.go
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,13 @@ func createExecutor(a api.API, appChainClient *AppChain) func(ctx echo.Context)
}

a.Log.Debug().Msgf("Request: %+v", req)
// Add the topic to the req.Config.Environment vars as TOPIC_ID
// This is used by the Allora Extension to know which topic it is being executed on
req.Config.Environment = append(req.Config.Environment, execute.EnvVar{
Name: "TOPIC_ID",
Value: req.Topic,
})

// Get the execution result.
code, id, results, cluster, err := a.Node.ExecuteFunction(ctx.Request().Context(), execute.Request(req.Request), req.Topic)
if err != nil {
Expand Down

0 comments on commit df81074

Please sign in to comment.