api/core: update dispatcher when proxy is changed

This commit is contained in:
jj 2025-07-19 15:24:13 +00:00
parent 5908e9da15
commit 09c42d9be0
No known key found for this signature in database

View File

@ -337,10 +337,12 @@ export const runAPI = async (express, app, __dirname, isPrimary = true) => {
randomizeCiphers();
setInterval(randomizeCiphers, 1000 * 60 * 30); // shuffle ciphers every 30 minutes
// TODO: remove env.externalProxy in a future version
setGlobalDispatcher(
new EnvHttpProxyAgent({ httpProxy: env.externalProxy || undefined })
);
env.subscribe('externalProxy', () => {
// TODO: remove env.externalProxy in a future version
setGlobalDispatcher(
new EnvHttpProxyAgent({ httpProxy: env.externalProxy || undefined })
);
});
http.createServer(app).listen({
port: env.apiPort,