From e9d6046997ccd60dbff7c526a5704f31c4c23d60 Mon Sep 17 00:00:00 2001 From: Gauthier Date: Thu, 11 Jul 2024 16:33:33 +0200 Subject: [PATCH] feat: set IPv4 first as an option --- .prettierignore | 1 + docs/getting-started/buildfromsource.mdx | 7 +++++-- next.config.js | 1 + server/index.ts | 6 ++++-- 4 files changed, 11 insertions(+), 4 deletions(-) diff --git a/.prettierignore b/.prettierignore index ad1f34fb7..e7f72ab6e 100644 --- a/.prettierignore +++ b/.prettierignore @@ -8,3 +8,4 @@ pnpm-lock.yaml # assets src/assets/ public/ +docs/ diff --git a/docs/getting-started/buildfromsource.mdx b/docs/getting-started/buildfromsource.mdx index a7b19282d..e81480106 100644 --- a/docs/getting-started/buildfromsource.mdx +++ b/docs/getting-started/buildfromsource.mdx @@ -79,7 +79,7 @@ pnpm start ``` - + :::info You can now access Jellyseerr by visiting `http://localhost:5055` in your web browser. ::: @@ -99,6 +99,9 @@ PORT=5055 ## Uncomment if your media server is emby instead of jellyfin. # JELLYFIN_TYPE=emby + +## Uncomment if you want to force Node.js to resolve IPv4 before IPv6 (advanced users only) +# FORCE_IPV4_FIRST=true ``` 2. Then run the following commands: ```bash @@ -312,7 +315,7 @@ node dist/index.js Now, Jellyseerr will start when the computer boots up in the background. - + To run jellyseerr as a service: 1. Download the [Non-Sucking Service Manager](https://nssm.cc/download) diff --git a/next.config.js b/next.config.js index aba627be9..d5ae508ab 100644 --- a/next.config.js +++ b/next.config.js @@ -4,6 +4,7 @@ module.exports = { env: { commitTag: process.env.COMMIT_TAG || 'local', + forceIpv4First: process.env.FORCE_IPV4_FIRST === 'true', }, publicRuntimeConfig: { // Will be available on both server and client diff --git a/server/index.ts b/server/index.ts index e532174c4..91b5e3c57 100644 --- a/server/index.ts +++ b/server/index.ts @@ -38,8 +38,10 @@ import path from 'path'; import swaggerUi from 'swagger-ui-express'; import YAML from 'yamljs'; -dns.setDefaultResultOrder('ipv4first'); -net.setDefaultAutoSelectFamily(false); +if (process.env.forceIpv4First) { + dns.setDefaultResultOrder('ipv4first'); + net.setDefaultAutoSelectFamily(false); +} const API_SPEC_PATH = path.join(__dirname, '../overseerr-api.yml');