@forge/cli
13.3.0-next.20-experimental-cf2ad4c13.3.0-next.12-experimental-4b981ef-experimental-5b8eb3c
out/command-line/proxy.js+
out/command-line/proxy.jsNew file+38
Index: package/out/command-line/proxy.js
===================================================================
--- package/out/command-line/proxy.js
+++ package/out/command-line/proxy.js
@@ -0,0 +1,38 @@
+"use strict";
+Object.defineProperty(exports, "__esModule", { value: true });
+exports.setupProxy = setupProxy;
+const tslib_1 = require("tslib");
+const cli_shared_1 = require("@forge/cli-shared");
+const http_proxy_agent_1 = require("http-proxy-agent");
+const https_proxy_agent_1 = require("https-proxy-agent");
+const http_1 = tslib_1.__importDefault(require("http"));
+const https_1 = tslib_1.__importDefault(require("https"));
+const undici_1 = require("undici");
+function setupProxy() {
+ const cachedConf = cli_shared_1.CachedConf.getCache(cli_shared_1.CONFIG_PROJECT_NAME);
+ const proxyUrl = cachedConf.get('proxy');
+ if (proxyUrl && proxyUrl.trim()) {
+ let httpAgent;
+ let httpsAgent;
+ let undiciProxyAgent;
+ if (process.env.NODE_TLS_REJECT_UNAUTHORIZED === '0') {
+ httpAgent = new http_proxy_agent_1.HttpProxyAgent(proxyUrl, { rejectUnauthorized: false });
+ httpsAgent = new https_proxy_agent_1.HttpsProxyAgent(proxyUrl, { rejectUnauthorized: false });
+ undiciProxyAgent = new undici_1.ProxyAgent({
+ uri: proxyUrl,
+ requestTls: { rejectUnauthorized: false },
+ proxyTls: { rejectUnauthorized: false }
+ });
+ }
+ else {
+ httpAgent = new http_proxy_agent_1.HttpProxyAgent(proxyUrl);
+ httpsAgent = new https_proxy_agent_1.HttpsProxyAgent(proxyUrl);
+ undiciProxyAgent = new undici_1.ProxyAgent(proxyUrl);
+ }
+ http_1.default.globalAgent = httpAgent;
+ https_1.default.globalAgent = httpsAgent;
+ (0, undici_1.setGlobalDispatcher)(undiciProxyAgent);
+ return { httpAgent, httpsAgent, undiciProxyAgent, proxy: new URL(proxyUrl) };
+ }
+}
+//# sourceMappingURL=proxy.js.map
\ No newline at end of file