Skip to content

Commit 9cfdd3f

Browse files
authored
Merge pull request #68 from thedadams/remove-disable-server
fix: remove the disable server environment variable
2 parents bb61df9 + c72e385 commit 9cfdd3f

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

gptscript.go

+5-1
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ func NewGPTScript(opts ...GlobalOptions) (*GPTScript, error) {
5151

5252
opt.Env = append(opt.Env, opt.toEnv()...)
5353

54-
if serverProcessCancel == nil && os.Getenv("GPTSCRIPT_DISABLE_SERVER") != "true" {
54+
if serverProcessCancel == nil && os.Getenv("GPTSCRIPT_URL") == "" {
5555
if serverURL != "" {
5656
u, err := url.Parse(serverURL)
5757
if err != nil {
@@ -66,6 +66,7 @@ func NewGPTScript(opts ...GlobalOptions) (*GPTScript, error) {
6666
opt.URL = "http://" + opt.URL
6767
}
6868

69+
opt.Env = append(opt.Env, "GPTSCRIPT_URL="+opt.URL)
6970
return &GPTScript{
7071
globalOpts: opt,
7172
}, nil
@@ -121,6 +122,9 @@ func NewGPTScript(opts ...GlobalOptions) (*GPTScript, error) {
121122
if !strings.HasPrefix(opt.URL, "http://") && !strings.HasPrefix(opt.URL, "https://") {
122123
opt.URL = "http://" + opt.URL
123124
}
125+
126+
opt.Env = append(opt.Env, "GPTSCRIPT_URL="+opt.URL)
127+
124128
return &GPTScript{
125129
globalOpts: opt,
126130
}, nil

0 commit comments

Comments
 (0)