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() { private getLocalIP() {
const interfaces = os.networkInterfaces() const interfaces = os.networkInterfaces()
let internalAddress = undefined
for (const interfaceName in interfaces) { for (const interfaceName in interfaces) {
const addresses = interfaces[interfaceName] const addresses = interfaces[interfaceName]
if (!addresses) { if (!addresses) {
continue continue
} }
for (const address of addresses) { for (const address of addresses) {
if (address.family === 'IPv4' && !address.internal) { if (address.family === 'IPv4') {
return address.address if (!address.internal) {
return address.address
}
internalAddress = address.address
} }
} }
} }
return internalAddress
} }
private async getHomeServerConfigurationObject(): Promise<HomeServerEnvironmentConfiguration | undefined> { private async getHomeServerConfigurationObject(): Promise<HomeServerEnvironmentConfiguration | undefined> {