Skip to content

Commit

Permalink
Revert "chore: stop passing GPTSCRIPT_ env vars to children"
Browse files Browse the repository at this point in the history
This reverts commit 472cafb.
  • Loading branch information
thedadams committed Sep 27, 2024
1 parent 472cafb commit 9f7fc5e
Showing 1 changed file with 19 additions and 0 deletions.
19 changes: 19 additions & 0 deletions src/gptscript.ts
Original file line number Diff line number Diff line change
Expand Up @@ -139,6 +139,17 @@ export class GPTScript {
if (!this.opts.URL) {
this.opts.URL = GPTScript.serverURL
}

if (!this.opts.Env) {
this.opts.Env = []
}
if (this.opts.URL) {
this.opts.Env.push(`GPTSCRIPT_URL=${this.opts.URL}`)
}

if (this.opts.Token) {
this.opts.Env.push(`GPTSCRIPT_TOKEN=${this.opts.Token}`)
}
}
}

Expand Down Expand Up @@ -400,6 +411,14 @@ export class GPTScript {
try {
await fetch(`${GPTScript.serverURL}/healthz`)
this.opts.URL = GPTScript.serverURL
if (!this.opts.Env) {
this.opts.Env = []
}
this.opts.Env.push(`GPTSCRIPT_URL=${this.opts.URL}`)
if (this.opts.Token) {
this.opts.Env.push(`GPTSCRIPT_TOKEN=${this.opts.Token}`)
}

return
} catch {
if (count === 0) {
Expand Down

0 comments on commit 9f7fc5e

Please sign in to comment.