Skip to content

Commit 056b9a1

Browse files
chore: Add GPTSCRIPT_HTTP_ENV_PREFIX to specify http env vars to send
1 parent 309e86c commit 056b9a1

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

pkg/engine/http.go

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -82,6 +82,16 @@ func (e *Engine) runHTTP(ctx context.Context, prg *types.Program, tool types.Too
8282
req.Header.Add("X-GPTScript-Env", k+"="+envMap[k])
8383
}
8484
}
85+
for _, prefix := range strings.Split(os.Getenv("GPTSCRIPT_HTTP_ENV_PREFIX"), ",") {
86+
if prefix == "" {
87+
continue
88+
}
89+
for _, k := range slices.Sorted(maps.Keys(envMap)) {
90+
if strings.HasPrefix(k, prefix) {
91+
req.Header.Add("X-GPTScript-Env", k+"="+envMap[k])
92+
}
93+
}
94+
}
8595

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

0 commit comments

Comments
 (0)