@forge/cli
12.11.012.12.0-next.9
out/command-line/index.jsout/command-line/index.js+15−4
Index: package/out/command-line/index.js
===================================================================
--- package/out/command-line/index.js
+++ package/out/command-line/index.js
@@ -1,9 +1,12 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.main = exports.registerCommands = exports.setupProxy = void 0;
+const tslib_1 = require("tslib");
const cli_shared_1 = require("@forge/cli-shared");
-const global_agent_1 = require("global-agent");
+const http_proxy_agent_1 = require("http-proxy-agent");
+const http_1 = tslib_1.__importDefault(require("http"));
+const https_1 = tslib_1.__importDefault(require("https"));
const dependency_injection_1 = require("./dependency-injection");
const version_info_1 = require("./version-info");
const register_app_commands_1 = require("./register-app-commands");
const register_authentication_command_1 = require("./register-authentication-command");
@@ -30,11 +33,19 @@
const register_custom_scopes_commands_1 = require("./register-custom-scopes-commands");
function setupProxy() {
const cachedConf = cli_shared_1.CachedConf.getCache(cli_shared_1.CONFIG_PROJECT_NAME);
const proxyUrl = cachedConf.get('proxy');
- if (proxyUrl) {
- (0, global_agent_1.bootstrap)();
- globalThis.GLOBAL_AGENT.HTTP_PROXY = proxyUrl;
+ if (proxyUrl && proxyUrl.trim()) {
+ let agent;
+ if (process.env.NODE_TLS_REJECT_UNAUTHORIZED === '0') {
+ agent = new http_proxy_agent_1.HttpProxyAgent(proxyUrl, { rejectUnauthorized: false });
+ }
+ else {
+ agent = new http_proxy_agent_1.HttpProxyAgent(proxyUrl);
+ }
+ http_1.default.globalAgent = agent;
+ https_1.default.globalAgent = agent;
+ return agent;
}
}
exports.setupProxy = setupProxy;
async function registerCommands(deps) {