chore: fix home server address when there is no internet connection (#2696)

This commit is contained in:
Karol Sójko
2023-12-13 11:36:07 +01:00
committed by GitHub
parent 8e73cee200
commit 695429e07f

View File

@@ -220,17 +220,25 @@ export class HomeServerManager implements HomeServerManagerInterface {
private getLocalIP() {
const interfaces = os.networkInterfaces()
let internalAddress = undefined
for (const interfaceName in interfaces) {
const addresses = interfaces[interfaceName]
if (!addresses) {
continue
}
for (const address of addresses) {
if (address.family === 'IPv4' && !address.internal) {
return address.address
if (address.family === 'IPv4') {
if (!address.internal) {
return address.address
}
internalAddress = address.address
}
}
}
return internalAddress
}
private async getHomeServerConfigurationObject(): Promise<HomeServerEnvironmentConfiguration | undefined> {