mirror of
https://github.com/ether/etherpad-lite.git
synced 2025-04-21 16:06:16 -04:00
Added proxy support for axios. (#6334)
This commit is contained in:
parent
15f36a1350
commit
0b80e256b4
3 changed files with 41 additions and 10 deletions
|
@ -27,6 +27,7 @@ import {ErrorCaused} from "./types/ErrorCaused";
|
|||
import log4js from 'log4js';
|
||||
import pkg from '../package.json';
|
||||
import {checkForMigration} from "../static/js/pluginfw/installer";
|
||||
import axios from "axios";
|
||||
|
||||
const settings = require('./utils/Settings');
|
||||
|
||||
|
@ -37,6 +38,28 @@ if (settings.dumpOnUncleanExit) {
|
|||
wtfnode = require('wtfnode');
|
||||
}
|
||||
|
||||
|
||||
const addProxyToAxios = (url: URL) => {
|
||||
axios.defaults.proxy = {
|
||||
host: url.hostname,
|
||||
port: Number(url.port),
|
||||
protocol: url.protocol,
|
||||
}
|
||||
}
|
||||
|
||||
if(process.env['http_proxy']) {
|
||||
console.log("Using proxy: " + process.env['http_proxy'])
|
||||
addProxyToAxios(new URL(process.env['http_proxy']));
|
||||
}
|
||||
|
||||
|
||||
if (process.env['https_proxy']) {
|
||||
console.log("Using proxy: " + process.env['https_proxy'])
|
||||
addProxyToAxios(new URL(process.env['https_proxy']));
|
||||
}
|
||||
|
||||
|
||||
|
||||
/*
|
||||
* early check for version compatibility before calling
|
||||
* any modules that require newer versions of NodeJS
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue