You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
12 lines
420 B
12 lines
420 B
import {HttpsProxyAgent} from "https-proxy-agent";
|
|
import {HttpProxyAgent} from "http-proxy-agent";
|
|
|
|
export function proxyAgent(requestUrl: URL): HttpProxyAgent | HttpsProxyAgent | undefined {
|
|
const proxy = process.env.GRIST_HTTPS_PROXY;
|
|
if (!proxy) {
|
|
return undefined;
|
|
}
|
|
const ProxyAgent = requestUrl.protocol === "https:" ? HttpsProxyAgent : HttpProxyAgent;
|
|
return new ProxyAgent(proxy);
|
|
}
|