NewCodexAuthWithProxyURL creates a new CodexAuth service instance. proxyURL takes precedence over cfg.ProxyURL when non-empty.
(cfg *config.Config, proxyURL string)
| 46 | // NewCodexAuthWithProxyURL creates a new CodexAuth service instance. |
| 47 | // proxyURL takes precedence over cfg.ProxyURL when non-empty. |
| 48 | func NewCodexAuthWithProxyURL(cfg *config.Config, proxyURL string) *CodexAuth { |
| 49 | effectiveProxyURL := strings.TrimSpace(proxyURL) |
| 50 | var sdkCfg config.SDKConfig |
| 51 | if cfg != nil { |
| 52 | sdkCfg = cfg.SDKConfig |
| 53 | if effectiveProxyURL == "" { |
| 54 | effectiveProxyURL = strings.TrimSpace(cfg.ProxyURL) |
| 55 | } |
| 56 | } |
| 57 | sdkCfg.ProxyURL = effectiveProxyURL |
| 58 | return &CodexAuth{ |
| 59 | httpClient: util.SetProxy(&sdkCfg, &http.Client{}), |
| 60 | } |
| 61 | } |
| 62 | |
| 63 | // GenerateAuthURL creates the OAuth authorization URL with PKCE (Proof Key for Code Exchange). |
| 64 | // It constructs the URL with the necessary parameters, including the client ID, |