MCPcopy Create free account
hub / github.com/github/gh-aw / GetCopilotAPITarget

Function GetCopilotAPITarget

pkg/workflow/engine_api_targets.go:147–158  ·  view source on GitHub ↗

GetCopilotAPITarget returns the effective Copilot API target hostname, checking in order: 1. engine.api-target (explicit, takes precedence) 2. GITHUB_COPILOT_BASE_URL in engine.env (implicit, derived from the configured Copilot base URL) This mirrors the pattern used by other engines: - Codex: O

(workflowData *WorkflowData)

Source from the content-addressed store, hash-verified

145//
146// Returns empty string if neither source is configured.
147func GetCopilotAPITarget(workflowData *WorkflowData) string {
148 awfHelpersLog.Print("Getting Copilot API target")
149 // Explicit engine.api-target takes precedence.
150 if workflowData != nil && workflowData.EngineConfig != nil && workflowData.EngineConfig.APITarget != "" {
151 awfHelpersLog.Printf("Using explicit Copilot api-target: %s", workflowData.EngineConfig.APITarget)
152 return workflowData.EngineConfig.APITarget
153 }
154
155 // Fallback: derive from the well-known GITHUB_COPILOT_BASE_URL env var.
156 awfHelpersLog.Print("No explicit api-target, deriving Copilot API target from GITHUB_COPILOT_BASE_URL")
157 return extractAPITargetHost(workflowData, "GITHUB_COPILOT_BASE_URL")
158}
159
160func extractLiteralEngineEnvHost(workflowData *WorkflowData, envVar string) string {
161 env := getEngineEnvOverrides(workflowData)

Callers 3

BuildAWFConfigJSONFunction · 0.85
TestGetCopilotAPITargetFunction · 0.85

Calls 3

extractAPITargetHostFunction · 0.85
PrintMethod · 0.80
PrintfMethod · 0.45

Tested by 1

TestGetCopilotAPITargetFunction · 0.68