From 3c6302347a40ecc76d4dcca3800efa4af5e30f27 Mon Sep 17 00:00:00 2001 From: Hieu Dang Date: Wed, 9 Aug 2023 23:49:57 +0700 Subject: [PATCH] fix announcedIp in network mode host --- app/src/config.template.js | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/app/src/config.template.js b/app/src/config.template.js index aa6ddf3c..73f7f4ec 100644 --- a/app/src/config.template.js +++ b/app/src/config.template.js @@ -5,14 +5,16 @@ const ifaces = os.networkInterfaces(); const getLocalIp = () => { let localIp = '127.0.0.1'; + let checkIp = true; Object.keys(ifaces).forEach((ifname) => { for (const iface of ifaces[ifname]) { // Ignore IPv6 and 127.0.0.1 - if (iface.family !== 'IPv4' || iface.internal !== false) { + if (iface.family !== 'IPv4' || iface.internal !== false || checkIp === false) { continue; } // Set the local ip to the first IPv4 address found and exit the loop localIp = iface.address; + checkIp = false return; } });