Skip to content

Commit 8b5deac

Browse files
committed
Fix 80 getting dropped from bind-addr
1 parent 9d87c53 commit 8b5deac

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

src/node/cli.ts

+4-1
Original file line numberDiff line numberDiff line change
@@ -401,7 +401,10 @@ export async function readConfigFile(configPath?: string): Promise<Args> {
401401

402402
function parseBindAddr(bindAddr: string): [string, number] {
403403
const u = new URL(`http://${bindAddr}`)
404-
return [u.hostname, parseInt(u.port, 10)]
404+
// With the http scheme 80 will be dropped so assume it's 80 if missing. This
405+
// means --bind-addr <addr> without a port will default to 80 as well and not
406+
// the code-server default.
407+
return [u.hostname, u.port ? parseInt(u.port, 10) : 80]
405408
}
406409

407410
interface Addr {

0 commit comments

Comments
 (0)