@forge/cli

13.4.0-next.5-experimental-016ed9d13.4.0-next.5-experimental-c575574
out/command-line/index.js
~out/command-line/index.jsModified
+2−21
Index: package/out/command-line/index.js
===================================================================
--- package/out/command-line/index.js
+++ package/out/command-line/index.js
@@ -1,16 +1,12 @@
 "use strict";
 Object.defineProperty(exports, "__esModule", { value: true });
 exports.main = void 0;
-exports.setupProxy = setupProxy;
 exports.registerCommands = registerCommands;
-const tslib_1 = require("tslib");
 const cli_shared_1 = require("@forge/cli-shared");
-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 proxy_1 = require("./proxy");
 const register_app_commands_1 = require("./register-app-commands");
 const register_authentication_command_1 = require("./register-authentication-command");
 const register_autocomplete_commands_1 = require("./register-autocomplete-commands");
 const register_build_commands_1 = require("./register-build-commands");
@@ -69,24 +65,8 @@
         }
     }
     deps.cmd.sortCommandsByGroup(Object.keys(COMMAND_HELP_GROUPS));
 }
-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 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;
-    }
-}
 async function registerCommands(deps) {
     (0, register_autocomplete_commands_1.registerCommands)(deps);
     (0, register_authentication_command_1.registerCommands)(deps);
     await (0, register_app_commands_1.registerCommands)(deps);
@@ -121,8 +101,9 @@
         await (0, cli_shared_1.exitOnError)(ui, reason);
     });
 };
 const main = async () => {
+    (0, proxy_1.setupProxy)();
     const cliDetails = (0, version_info_1.getCLIDetails)();
     const deps = await (0, dependency_injection_1.getDependencies)(cliDetails);
     registerEvents(deps);
     await registerCommands(deps);