Skip to content

Commit

Permalink
chore: Add GPTSCRIPT_HTTP_ENV_PREFIX to specify http env vars to send
Browse files Browse the repository at this point in the history
  • Loading branch information
ibuildthecloud committed Nov 11, 2024
1 parent 02bcf6c commit 176942a
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions pkg/engine/http.go
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,16 @@ func (e *Engine) runHTTP(ctx context.Context, prg *types.Program, tool types.Too
req.Header.Add("X-GPTScript-Env", k+"="+envMap[k])
}
}
for _, prefix := range strings.Split(os.Getenv("GPTSCRIPT_HTTP_ENV_PREFIX"), ",") {
if prefix == "" {
continue
}
for _, k := range slices.Sorted(maps.Keys(envMap)) {
if strings.HasPrefix(k, prefix) {
req.Header.Add("X-GPTScript-Env", k+"="+envMap[k])
}
}
}

req.Header.Set("X-GPTScript-Tool-Name", tool.Parameters.Name)

Expand Down

0 comments on commit 176942a

Please sign in to comment.