Lazy import proxy-agent
This commit is contained in:
parent
83e8f4b59d
commit
091b50c414
9 changed files with 60 additions and 39 deletions
|
@ -24,13 +24,15 @@ export function getCertificateAuthority(): string {
|
|||
return config.get('certificateAuthority');
|
||||
}
|
||||
|
||||
export function getGotOptions(): GotOptions {
|
||||
export type { GotOptions };
|
||||
|
||||
export async function getGotOptions(): Promise<GotOptions> {
|
||||
const certificateAuthority = getCertificateAuthority();
|
||||
const proxyUrl = getProxyUrl();
|
||||
const agent = proxyUrl
|
||||
? {
|
||||
http: createProxyAgent(proxyUrl),
|
||||
https: createProxyAgent(proxyUrl),
|
||||
http: await createProxyAgent(proxyUrl),
|
||||
https: await createProxyAgent(proxyUrl),
|
||||
}
|
||||
: {
|
||||
http: new HTTPAgent(),
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue