Skip to content

Commit

Permalink
fix: logic
Browse files Browse the repository at this point in the history
  • Loading branch information
alexander-akait committed Aug 6, 2024
1 parent b536bf2 commit cbc8877
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
6 changes: 3 additions & 3 deletions lib/Server.js
Original file line number Diff line number Diff line change
Expand Up @@ -464,12 +464,12 @@ class Server {
static async getHostname(hostname) {
if (hostname === "local-ip") {
return (
Server.internalIPSync("v4") || Server.internalIPSync("v6") || "0.0.0.0"
Server.findIp("v4", false) || Server.findIp("v6", false) || "0.0.0.0"
);
} else if (hostname === "local-ipv4") {
return Server.internalIPSync("v4") || "0.0.0.0";
return Server.findIp("v4", false) || "0.0.0.0";
} else if (hostname === "local-ipv6") {
return Server.internalIPSync("v6") || "::";
return Server.findIp("v6", false) || "::";
}

return hostname;
Expand Down
4 changes: 2 additions & 2 deletions test/cli/host-option.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@ const { testBin, normalizeStderr } = require("../helpers/test-bin");
const port = require("../ports-map")["cli-host"];
const Server = require("../../lib/Server");

const localIPv4 = Server.internalIPSync("v4");
const localIPv6 = Server.internalIPSync("v6");
const localIPv4 = Server.findIp("v4", false);
const localIPv6 = Server.findIp("v6", false);

describe('"host" CLI option', () => {
it('should work using "--host 0.0.0.0" (IPv4)', async () => {
Expand Down

0 comments on commit cbc8877

Please sign in to comment.