File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -247,6 +247,23 @@ func GetLocalConns(options ...any) ConnEntries {
247247 }
248248
249249 connArr := lo .Values (connsMap )
250+
251+ // inject any additional API OAuth secrets
252+ oauthMap := env .GetOAuthMap ()
253+ for i , entry := range connArr {
254+ secrets := cast .ToStringMap (connArr [i ].Connection .Data ["secrets" ])
255+ specConnector := strings .ToLower (entry .Connection .DataS (true )["spec" ])
256+ if connData , ok := oauthMap [specConnector ]; ok {
257+ for k , v := range connData {
258+ if _ , ok := secrets [k ]; ! ok {
259+ secrets [k ] = v // write if not exist
260+ }
261+ }
262+ connArr [i ].Connection .Data ["secrets" ] = secrets // update secrets
263+ }
264+ }
265+ oauthMap = nil
266+
250267 sort .Slice (connArr , func (i , j int ) bool {
251268 return cast .ToString (connArr [i ].Name ) < cast .ToString (connArr [j ].Name )
252269 })
Original file line number Diff line number Diff line change 3434 Executable = ""
3535 IsThreadChild = cast .ToBool (os .Getenv ("SLING_THREAD_CHILD" ))
3636 IsAgentMode = os .Getenv ("SLING_AGENT_ID" ) != ""
37+ GetOAuthMap = func () map [string ]map [string ]any { return map [string ]map [string ]any {} }
3738 setupOtel = func () {}
3839)
3940
You can’t perform that action at this time.
0 commit comments