Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 13 additions & 2 deletions src/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,20 @@ import { SwaggerConfiguratorCore } from './core/SwaggerConfiguratorCore';
import { AllExceptionsFilter } from './nestjs/AllExceptionsFilter';
import { getWAHAVersion, VERSION, WAHAVersion } from './version';
import { loadESMModules } from '@waha/vendor/esm';
import { setGlobalDispatcher, Agent } from 'undici';
import { setGlobalDispatcher, Agent, EnvHttpProxyAgent } from 'undici';

setGlobalDispatcher(new Agent({ connect: { family: 4 } }));
// fetch (media download) ignores HTTP(S)_PROXY unless the dispatcher handles it
const proxyUrl =
process.env.https_proxy ||
process.env.HTTPS_PROXY ||
process.env.http_proxy ||
process.env.HTTP_PROXY;

setGlobalDispatcher(
proxyUrl
? new EnvHttpProxyAgent({ connect: { family: 4 } })
: new Agent({ connect: { family: 4 } }),
);

const logger: Logger = pino({
level: getPinoLogLevel(),
Expand Down