Skip to content

Commit b9452c5

Browse files
committed
enhance: set sdk cred override env var for ui
Pass credential overrides to the UI by setting the UI tool's `GPTSCRIPT_SDKSERVER_CREDENTIAL_OVERRIDE` environment variable before running it. Signed-off-by: Nick Hale <[email protected]>
1 parent 134dcde commit b9452c5

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

pkg/cli/gptscript.go

+4-1
Original file line numberDiff line numberDiff line change
@@ -363,10 +363,13 @@ func (r *GPTScript) Run(cmd *cobra.Command, args []string) (retErr error) {
363363
gptOpt.Env = append(gptOpt.Env, system.BinEnvVar+"="+system.Bin())
364364
}
365365

366-
// If the DefaultModel is set, then pass the correct environment variable.
366+
// Pass the corrected environment variables for SDK server options
367367
if r.DefaultModel != "" {
368368
gptOpt.Env = append(gptOpt.Env, "GPTSCRIPT_SDKSERVER_DEFAULT_MODEL="+r.DefaultModel)
369369
}
370+
if len(r.CredentialOverride) > 0 {
371+
gptOpt.Env = append(gptOpt.Env, "GPTSCRIPT_SDKSERVER_CREDENTIAL_OVERRIDE="+strings.Join(r.CredentialOverride, " "))
372+
}
370373

371374
args = append([]string{args[0]}, "--file="+file)
372375

0 commit comments

Comments
 (0)