Files
renovate/lib/util/exec/env.ts
T
2020-01-29 06:29:53 +01:00

27 lines
554 B
TypeScript

const basicEnvVars = [
'HTTP_PROXY',
'HTTPS_PROXY',
'NO_PROXY',
'HOME',
'PATH',
'LC_ALL',
'LANG',
'DOCKER_HOST',
];
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;
}