Skip to content

Commit 9f7fc5e

Browse files
committed
Revert "chore: stop passing GPTSCRIPT_ env vars to children"
This reverts commit 472cafb.
1 parent 472cafb commit 9f7fc5e

File tree

1 file changed

+19
-0
lines changed

1 file changed

+19
-0
lines changed

src/gptscript.ts

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -139,6 +139,17 @@ export class GPTScript {
139139
if (!this.opts.URL) {
140140
this.opts.URL = GPTScript.serverURL
141141
}
142+
143+
if (!this.opts.Env) {
144+
this.opts.Env = []
145+
}
146+
if (this.opts.URL) {
147+
this.opts.Env.push(`GPTSCRIPT_URL=${this.opts.URL}`)
148+
}
149+
150+
if (this.opts.Token) {
151+
this.opts.Env.push(`GPTSCRIPT_TOKEN=${this.opts.Token}`)
152+
}
142153
}
143154
}
144155

@@ -400,6 +411,14 @@ export class GPTScript {
400411
try {
401412
await fetch(`${GPTScript.serverURL}/healthz`)
402413
this.opts.URL = GPTScript.serverURL
414+
if (!this.opts.Env) {
415+
this.opts.Env = []
416+
}
417+
this.opts.Env.push(`GPTSCRIPT_URL=${this.opts.URL}`)
418+
if (this.opts.Token) {
419+
this.opts.Env.push(`GPTSCRIPT_TOKEN=${this.opts.Token}`)
420+
}
421+
403422
return
404423
} catch {
405424
if (count === 0) {

0 commit comments

Comments
 (0)