mirror of
https://github.com/AikidoSec/safe-chain.git
synced 2026-05-26 12:10:49 +00:00
Remove the normalisation bits added in error
This commit is contained in:
parent
5f56114185
commit
55f2123f5c
2 changed files with 6 additions and 44 deletions
|
|
@ -9,7 +9,7 @@ import { reportCommandExecutionFailure } from "../_shared/commandErrors.js";
|
||||||
*/
|
*/
|
||||||
export async function runRushCommand(executableName, args) {
|
export async function runRushCommand(executableName, args) {
|
||||||
try {
|
try {
|
||||||
const env = normalizeProxyEnvironmentVariables(
|
const env = prepareRushEnvironmentVariables(
|
||||||
mergeSafeChainProxyEnvironmentVariables(process.env),
|
mergeSafeChainProxyEnvironmentVariables(process.env),
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|
@ -25,48 +25,17 @@ export async function runRushCommand(executableName, args) {
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Ensure proxy settings are visible to package manager variants that rely on
|
|
||||||
* lowercase or npm/yarn-specific environment variables.
|
|
||||||
*
|
|
||||||
* @param {Record<string, string>} env
|
* @param {Record<string, string>} env
|
||||||
* @returns {Record<string, string>}
|
* @returns {Record<string, string>}
|
||||||
*/
|
*/
|
||||||
function normalizeProxyEnvironmentVariables(env) {
|
function prepareRushEnvironmentVariables(env) {
|
||||||
const normalized = {
|
const prepared = {
|
||||||
...env,
|
...env,
|
||||||
};
|
};
|
||||||
|
|
||||||
if (normalized.HTTPS_PROXY && !normalized.HTTP_PROXY) {
|
if (prepared.HTTPS_PROXY && !prepared.HTTP_PROXY) {
|
||||||
normalized.HTTP_PROXY = normalized.HTTPS_PROXY;
|
prepared.HTTP_PROXY = prepared.HTTPS_PROXY;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (normalized.HTTP_PROXY && !normalized.http_proxy) {
|
return prepared;
|
||||||
normalized.http_proxy = normalized.HTTP_PROXY;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (normalized.HTTPS_PROXY && !normalized.https_proxy) {
|
|
||||||
normalized.https_proxy = normalized.HTTPS_PROXY;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (normalized.HTTP_PROXY && !normalized.npm_config_proxy) {
|
|
||||||
normalized.npm_config_proxy = normalized.HTTP_PROXY;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (normalized.HTTPS_PROXY && !normalized.npm_config_https_proxy) {
|
|
||||||
normalized.npm_config_https_proxy = normalized.HTTPS_PROXY;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (normalized.HTTP_PROXY && !normalized.NPM_CONFIG_PROXY) {
|
|
||||||
normalized.NPM_CONFIG_PROXY = normalized.HTTP_PROXY;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (normalized.HTTPS_PROXY && !normalized.NPM_CONFIG_HTTPS_PROXY) {
|
|
||||||
normalized.NPM_CONFIG_HTTPS_PROXY = normalized.HTTPS_PROXY;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (normalized.HTTPS_PROXY && !normalized.YARN_HTTPS_PROXY) {
|
|
||||||
normalized.YARN_HTTPS_PROXY = normalized.HTTPS_PROXY;
|
|
||||||
}
|
|
||||||
|
|
||||||
return normalized;
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -75,13 +75,6 @@ describe("runRushCommand", () => {
|
||||||
assert.strictEqual(options.stdio, "inherit");
|
assert.strictEqual(options.stdio, "inherit");
|
||||||
assert.strictEqual(options.env.HTTPS_PROXY, "http://localhost:8080");
|
assert.strictEqual(options.env.HTTPS_PROXY, "http://localhost:8080");
|
||||||
assert.strictEqual(options.env.HTTP_PROXY, "http://localhost:8080");
|
assert.strictEqual(options.env.HTTP_PROXY, "http://localhost:8080");
|
||||||
assert.strictEqual(options.env.https_proxy, "http://localhost:8080");
|
|
||||||
assert.strictEqual(options.env.http_proxy, "http://localhost:8080");
|
|
||||||
assert.strictEqual(options.env.npm_config_https_proxy, "http://localhost:8080");
|
|
||||||
assert.strictEqual(options.env.npm_config_proxy, "http://localhost:8080");
|
|
||||||
assert.strictEqual(options.env.NPM_CONFIG_HTTPS_PROXY, "http://localhost:8080");
|
|
||||||
assert.strictEqual(options.env.NPM_CONFIG_PROXY, "http://localhost:8080");
|
|
||||||
assert.strictEqual(options.env.YARN_HTTPS_PROXY, "http://localhost:8080");
|
|
||||||
assert.ok(mergeCalls.length >= 1, "proxy env merge should be called");
|
assert.ok(mergeCalls.length >= 1, "proxy env merge should be called");
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue