mirror of
https://github.com/renovatebot/renovate.git
synced 2025-01-14 08:36:26 +00:00
06d8c27043
Co-authored-by: Michael Kriese <michael.kriese@visualon.de>
33 lines
700 B
TypeScript
33 lines
700 B
TypeScript
import { GlobalConfig } from '../../config/global';
|
|
|
|
const basicEnvVars = [
|
|
'HTTP_PROXY',
|
|
'HTTPS_PROXY',
|
|
'NO_PROXY',
|
|
'http_proxy',
|
|
'https_proxy',
|
|
'no_proxy',
|
|
'HOME',
|
|
'PATH',
|
|
'LC_ALL',
|
|
'LANG',
|
|
'DOCKER_HOST',
|
|
'DOCKER_TLS_VERIFY',
|
|
'DOCKER_CERT_PATH',
|
|
];
|
|
|
|
export function getChildProcessEnv(
|
|
customEnvVars: string[] = []
|
|
): NodeJS.ProcessEnv {
|
|
const env: NodeJS.ProcessEnv = {};
|
|
if (GlobalConfig.get('exposeAllEnv')) {
|
|
return { ...env, ...process.env };
|
|
}
|
|
const envVars = [...basicEnvVars, ...customEnvVars];
|
|
envVars.forEach((envVar) => {
|
|
if (typeof process.env[envVar] !== 'undefined') {
|
|
env[envVar] = process.env[envVar];
|
|
}
|
|
});
|
|
return env;
|
|
}
|