Move existing proxy files to builtInProxy folder

This commit is contained in:
Sander Declerck 2026-02-11 16:04:03 +01:00
parent 03ecd0dfb9
commit ca071729be
No known key found for this signature in database
31 changed files with 766 additions and 397 deletions

View file

@ -1,11 +1,11 @@
import { ui } from "../../environment/userInteraction.js";
import { safeSpawn } from "../../utils/safeSpawn.js";
import { mergeSafeChainProxyEnvironmentVariables } from "../../registryProxy/registryProxy.js";
import { getCombinedCaBundlePath } from "../../registryProxy/certBundle.js";
import { getCombinedCaBundlePath } from "../../registryProxy/builtInProxy/certBundle.js";
/**
* Sets CA bundle environment variables used by Python libraries and pipx.
*
*
* @param {NodeJS.ProcessEnv} env - Env object
* @param {string} combinedCaPath - Path to the combined CA bundle
* @return {NodeJS.ProcessEnv} Modified environment object
@ -14,17 +14,23 @@ function getPipXCaBundleEnvironmentVariables(env, combinedCaPath) {
let retVal = { ...env };
if (env.SSL_CERT_FILE) {
ui.writeWarning("Safe-chain: User defined SSL_CERT_FILE found in environment. It will be overwritten.");
ui.writeWarning(
"Safe-chain: User defined SSL_CERT_FILE found in environment. It will be overwritten.",
);
}
retVal.SSL_CERT_FILE = combinedCaPath;
if (env.REQUESTS_CA_BUNDLE) {
ui.writeWarning("Safe-chain: User defined REQUESTS_CA_BUNDLE found in environment. It will be overwritten.");
ui.writeWarning(
"Safe-chain: User defined REQUESTS_CA_BUNDLE found in environment. It will be overwritten.",
);
}
retVal.REQUESTS_CA_BUNDLE = combinedCaPath;
if (env.PIP_CERT) {
ui.writeWarning("Safe-chain: User defined PIP_CERT found in environment. It will be overwritten.");
ui.writeWarning(
"Safe-chain: User defined PIP_CERT found in environment. It will be overwritten.",
);
}
retVal.PIP_CERT = combinedCaPath;
return retVal;
@ -32,7 +38,7 @@ function getPipXCaBundleEnvironmentVariables(env, combinedCaPath) {
/**
* Runs a pipx command with safe-chain's certificate bundle and proxy configuration.
*
*
* @param {string} command - The command to execute
* @param {string[]} args - Command line arguments
* @returns {Promise<{status: number}>} Exit status of the command
@ -42,7 +48,10 @@ export async function runPipX(command, args) {
const env = mergeSafeChainProxyEnvironmentVariables(process.env);
const combinedCaPath = getCombinedCaBundlePath();
const modifiedEnv = getPipXCaBundleEnvironmentVariables(env, combinedCaPath);
const modifiedEnv = getPipXCaBundleEnvironmentVariables(
env,
combinedCaPath,
);
// Note: pipx uses HTTPS_PROXY and HTTP_PROXY environment variables for proxy configuration
// These are already set by mergeSafeChainProxyEnvironmentVariables