From a8ffe249f4bd442e0dd075c29f3e780f0651d532 Mon Sep 17 00:00:00 2001 From: Chris Debenham Date: Mon, 9 Oct 2023 11:25:16 +1100 Subject: [PATCH] Determine interface of default network rather than assume eth0 --- src/config.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/config.js b/src/config.js index 30f9221c..8ee83661 100644 --- a/src/config.js +++ b/src/config.js @@ -1,12 +1,13 @@ 'use strict'; const { release } = require('./package.json'); +const { execSync } = require('child_process'); module.exports.RELEASE = release; module.exports.PORT = process.env.PORT || 51821; module.exports.PASSWORD = process.env.PASSWORD; module.exports.WG_PATH = process.env.WG_PATH || '/etc/wireguard/'; -module.exports.WG_DEVICE = process.env.WG_DEVICE || 'eth0'; +module.exports.WG_DEVICE = process.env.WG_DEVICE || execSync("ip r | grep default | cut -d ' ' -f 5 | head -n1"); module.exports.WG_HOST = process.env.WG_HOST; module.exports.WG_PORT = process.env.WG_PORT || 51820; module.exports.WG_MTU = process.env.WG_MTU || null;