Skip to content

Commit

Permalink
fix(api): error on multiple default network interfaces
Browse files Browse the repository at this point in the history
fixes #118
  • Loading branch information
MauriceNino committed Jun 15, 2022
1 parent 78096d9 commit 3cf8774
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion apps/api/src/setup-networking.ts
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,16 @@ export const setupNetworking = async () => {
"nsenter --net=/mnt/host_ns_net route | grep default | awk '{print $8}'"
);

const iface = stdout.trim();
const ifaces = stdout.split('\n');
const iface = ifaces[0].trim();

if (ifaces.length > 1) {
console.warn(
`Multiple default network interfaces found [${ifaces.join(
', '
)}], using "${iface}"`
);
}

if (iface !== '') {
NET_INTERFACE = iface;
Expand Down

0 comments on commit 3cf8774

Please sign in to comment.