fix bug
This commit is contained in:
parent
9b33014958
commit
bb0b0169c7
2 changed files with 1 additions and 14 deletions
|
@ -1,13 +0,0 @@
|
|||
import os from 'os'
|
||||
export function getNetworkAddress(){
|
||||
const interfaces = os.networkInterfaces();
|
||||
const ips: string[] = [];
|
||||
Object.keys(interfaces).forEach((nic) => {
|
||||
interfaces[nic]!.forEach((details) => {
|
||||
if (details.family === 'IPv4' && !details.internal) {
|
||||
ips.push(details.address);
|
||||
}
|
||||
});
|
||||
});
|
||||
return ips?.[0] ? ips?.[0] : '127.0.0.1';
|
||||
}
|
|
@ -30,7 +30,7 @@ export function getResolvedHostForHttpServer(host: string | boolean) {
|
|||
return '127.0.0.1';
|
||||
} else if (host === true) {
|
||||
// If passed --host in the CLI without arguments
|
||||
return getNetworkAddress(); // undefined typically means 0.0.0.0 or :: (listen on all IPs)
|
||||
return undefined; // undefined typically means 0.0.0.0 or :: (listen on all IPs)
|
||||
} else {
|
||||
return host;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue