MCPcopy Create free account
hub / github.com/Zoo-Code-Org/Zoo-Code / getProxyConfig

Function getProxyConfig

src/utils/networkProxy.ts:187–215  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

185 * Get the current proxy configuration based on VS Code settings and extension mode.
186 */
187export function getProxyConfig(): ProxyConfig {
188 const defaultServerUrl = "http://127.0.0.1:8888"
189
190 if (!extensionContext) {
191 // Fallback if called before initialization
192 return {
193 enabled: false,
194 serverUrl: defaultServerUrl,
195 tlsInsecure: false,
196 isDebugMode: false,
197 }
198 }
199
200 const config = vscode.workspace.getConfiguration(Package.name)
201 const enabled = Boolean(config.get<unknown>("debugProxy.enabled"))
202 const rawServerUrl = config.get<unknown>("debugProxy.serverUrl")
203 const serverUrl = typeof rawServerUrl === "string" && rawServerUrl.trim() ? rawServerUrl.trim() : defaultServerUrl
204 const tlsInsecure = Boolean(config.get<unknown>("debugProxy.tlsInsecure"))
205
206 // Debug mode only.
207 const isDebugMode = extensionContext.extensionMode === vscode.ExtensionMode.Development
208
209 return {
210 enabled,
211 serverUrl,
212 tlsInsecure,
213 isDebugMode,
214 }
215}
216
217/**
218 * Configure global-agent to route all HTTP/HTTPS traffic through the proxy.

Callers 3

initializeNetworkProxyFunction · 0.85
isProxyEnabledFunction · 0.85

Calls 2

getConfigurationMethod · 0.65
getMethod · 0.65

Tested by

no test coverage detected