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)
| 145 | // |
| 146 | // Returns empty string if neither source is configured. |
| 147 | func 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 | |
| 160 | func extractLiteralEngineEnvHost(workflowData *WorkflowData, envVar string) string { |
| 161 | env := getEngineEnvOverrides(workflowData) |