File tree Expand file tree Collapse file tree 2 files changed +19
-4
lines changed Expand file tree Collapse file tree 2 files changed +19
-4
lines changed Original file line number Diff line number Diff line change @@ -84,6 +84,14 @@ func (c *CaseInsensitiveEnv) Set(key, value string) {
8484 c .data [strings .ToLower (key )] = value
8585}
8686
87+ func (c * CaseInsensitiveEnv ) All () map [string ]string {
88+ result := make (map [string ]string , len (c .data ))
89+ for k , v := range c .data {
90+ result [k ] = v
91+ }
92+ return result
93+ }
94+
8795type ToolCallEnv struct {
8896 SystemEnv * CaseInsensitiveEnv
8997 UserConfig * CaseInsensitiveEnv
Original file line number Diff line number Diff line change @@ -204,10 +204,17 @@ func (tp *ToolProxy) doFunction(
204204 return oops .E (oops .CodeBadRequest , err , "failed to read request body" ).Log (ctx , logger )
205205 }
206206
207- payloadEnv := make (map [string ]string , len (plan .Variables ))
208- for _ , v := range plan .Variables {
209- if val := env .Get (v ); val != "" {
210- payloadEnv [v ] = val
207+ payloadEnv := make (map [string ]string )
208+
209+ // Start with system environment variables
210+ for k , v := range env .SystemEnv .All () {
211+ payloadEnv [k ] = v
212+ }
213+
214+ // For each variable required by the function, allow user config to merge/override
215+ for _ , varName := range plan .Variables {
216+ if val := env .UserConfig .Get (varName ); val != "" {
217+ payloadEnv [varName ] = val
211218 }
212219 }
213220
You can’t perform that action at this time.
0 commit comments