feat: proxy setting (#1031)

* feat: add a proxy option into settings

* feat: add a proxy option into settings

* fix: use undici proxy agent
This commit is contained in:
Gauthier
2024-10-26 12:19:42 +02:00
committed by GitHub
parent d331798b28
commit 4b4eeb6ec7
6 changed files with 68 additions and 40 deletions

View File

@@ -38,6 +38,7 @@ import dns from 'node:dns';
import net from 'node:net';
import path from 'path';
import swaggerUi from 'swagger-ui-express';
import { ProxyAgent, setGlobalDispatcher } from 'undici';
import YAML from 'yamljs';
if (process.env.forceIpv4First === 'true') {
@@ -74,6 +75,11 @@ app
const settings = await getSettings().load();
restartFlag.initializeSettings(settings.main);
// Register HTTP proxy
if (settings.main.httpProxy) {
setGlobalDispatcher(new ProxyAgent(settings.main.httpProxy));
}
// Migrate library types
if (
settings.plex.libraries.length > 1 &&