Skip to content

Commit

Permalink
chore: fix home server address when there is no internet connection
Browse files Browse the repository at this point in the history
  • Loading branch information
karolsojko committed Dec 13, 2023
1 parent b7f037a commit 9cbdfc6
Showing 1 changed file with 10 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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> {
Expand Down

0 comments on commit 9cbdfc6

Please sign in to comment.