Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
function setupProxy() {
var globalAgent = require('global-agent');
var globalTunnel = require('global-tunnel-ng');
var proxyAddress = getProxyAndSetupEnv();
const NODEJS_VERSION = parseInt(process.version.slice(1).split('.')[0], 10);
if (NODEJS_VERSION >= 10 && proxyAddress) {
// `global-agent` works with Node.js v10 and above.
globalAgent.bootstrap();
global.GLOBAL_AGENT.HTTP_PROXY = proxyAddress;
} else {
// `global-tunnel-ng` works only with Node.js v10 and below.
globalTunnel.initialize();
}
}
const stringLength = require('string-length');
const rootCheck = require('root-check');
const meow = require('meow');
const list = require('cli-list');
const Tabtab = require('tabtab');
const pkg = require('../package.json');
const Router = require('./router');
const gens = list(process.argv.slice(2));
// Override http networking to go through a proxy ifone is configured
const MAJOR_NODEJS_VERSION = parseInt(process.version.slice(1).split('.')[0], 10);
if (MAJOR_NODEJS_VERSION >= 10) {
// `global-agent` works with Node.js v10 and above.
require('global-agent').bootstrap();
} else {
// `global-tunnel-ng` works only with Node.js v10 and below.
require('global-tunnel-ng').initialize();
}
/* eslint new-cap: 0, no-extra-parens: 0 */
const tabtab = new Tabtab.Commands.default({
name: 'yo',
completer: 'yo-complete'
});
const cli = gens.map(gen => {
const minicli = meow({help: false, pkg, argv: gen});
const opts = minicli.flags;
const args = minicli.input;
#!/usr/bin/env node
'use strict';
require('.')();
// Override http networking to go through a proxy if one is configured.
const MAJOR_NODEJS_VERSION = parseInt(process.version.slice(1).split('.')[0], 10);
if (MAJOR_NODEJS_VERSION >= 10) {
// `global-agent` works with Node.js v10 and above.
require('global-agent').bootstrap();
} else {
// `global-tunnel-ng` works only with Node.js v10 and below.
require('global-tunnel-ng').initialize();
}
export function registerGlobalProxyAgent() {
bootstrap()
const config = JSON.stringify(GLOBAL_AGENT || {})
logger.log("Proxy config:", config)
}