mirror of
https://github.com/renovatebot/renovate.git
synced 2025-01-15 00:56:26 +00:00
4f59b62da4
* chore(deps): update dependency prettier to v2 * Run prettier-fix Co-authored-by: Renovate Bot <bot@renovateapp.com> Co-authored-by: Jamie Magee <jamie.magee@gmail.com>
26 lines
556 B
TypeScript
26 lines
556 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;
|
|
}
|