mirror of
https://github.com/renovatebot/renovate.git
synced 2025-01-25 22:16:26 +00:00
17 lines
502 B
TypeScript
17 lines
502 B
TypeScript
const basicEnvVars = ['HTTP_PROXY', 'HTTPS_PROXY', 'NO_PROXY', 'HOME', 'PATH'];
|
|
|
|
export function getChildProcessEnv(
|
|
customEnvVars: string[] = []
|
|
): NodeJS.ProcessEnv {
|
|
const env: NodeJS.ProcessEnv = {};
|
|
if (global.trustLevel === 'high') {
|
|
return Object.assign(env, process.env);
|
|
}
|
|
const envVars = [...basicEnvVars, ...customEnvVars];
|
|
envVars.forEach(envVar => {
|
|
if (typeof process.env[envVar] !== 'undefined') {
|
|
env[envVar] = process.env[envVar];
|
|
}
|
|
});
|
|
return env;
|
|
}
|