mirror of
https://github.com/hashicorp/vault-action.git
synced 2025-11-07 07:06:56 +00:00
22 lines
No EOL
736 B
JavaScript
22 lines
No EOL
736 B
JavaScript
const {bootstrap} = require('global-agent');
|
|
const core = require("@actions/core");
|
|
const MAJOR_NODEJS_VERSION = parseInt(process.version.slice(1).split('.')[0], 10);
|
|
|
|
/**
|
|
* Will enable global-agent proxy if the necessary
|
|
* [global-agent environment variables](https://github.com/gajus/global-agent?tab=readme-ov-file#environment-variables)
|
|
* has been set.
|
|
* The global-agent bootstrap routine guards against multiple initializations of global-agent
|
|
* Important note: `global-agent` only works with Node.js v10 and above.
|
|
*/
|
|
function enableProxy() {
|
|
if (MAJOR_NODEJS_VERSION >= 10) {
|
|
bootstrap();
|
|
} else {
|
|
core.debug('proxy configuration does not work with Node.js below v10')
|
|
}
|
|
}
|
|
|
|
module.exports = {
|
|
enableProxy
|
|
} |