Skip to content

Commit

Permalink
fixing failing test
Browse files Browse the repository at this point in the history
  • Loading branch information
sinasab committed Oct 9, 2024
1 parent 33ac862 commit 321a4fe
Show file tree
Hide file tree
Showing 5 changed files with 17 additions and 14 deletions.
5 changes: 5 additions & 0 deletions .changeset/curvy-carrots-cough.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@ponder/core": patch
---

Setting default hostname to "::" to support ipv6
6 changes: 3 additions & 3 deletions docs/pages/docs/api-reference/ponder-cli.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ Start the development server with hot reloading

Options:
-p, --port <PORT> Port for the web server (default: 42069)
-H, --hostname <HOSTNAME> Hostname for the web server (default: "0.0.0.0" or "::")
-H, --hostname <HOSTNAME> Hostname for the web server (default: "::")
-h, --help display help for command
```

Expand All @@ -61,7 +61,7 @@ Start the production server

Options:
-p, --port <PORT> Port for the web server (default: 42069)
-H, --hostname <HOSTNAME> Hostname for the web server (default: "0.0.0.0" or "::")
-H, --hostname <HOSTNAME> Hostname for the web server (default: "::")
-h, --help display help for command
```

Expand All @@ -81,7 +81,7 @@ Start the production HTTP server without the indexer

Options:
-p, --port <PORT> Port for the web server (default: 42069)
-H, --hostname <HOSTNAME> Hostname for the web server (default: "0.0.0.0" or "::")
-H, --hostname <HOSTNAME> Hostname for the web server (default: "::")
-h, --help display help for command
```

Expand Down
15 changes: 8 additions & 7 deletions packages/core/src/bin/ponder.ts
Original file line number Diff line number Diff line change
Expand Up @@ -61,13 +61,12 @@ type GlobalOptions = {
const devCommand = new Command("dev")
.description("Start the development server with hot reloading")
.option("-p, --port <PORT>", "Port for the web server", Number, 42069)
// NOTE: Do not set a default for hostname. We currently rely on the Node.js
// default behavior when passing undefined to http.Server.listen(), which
// detects the available interfaces (IPv4 and/or IPv6) and uses them.
// Documentation: https://arc.net/l/quote/dnjmtumq
// NOTE: hono/node-server's default behavior is to listen only on IPv4.
// Reference: https://github.com/honojs/node-server/blob/main/src/server.ts#L24
.option(
"-H, --hostname <HOSTNAME>",
'Hostname for the web server (default: "0.0.0.0" or "::")',
'Hostname for the web server (default: "::")',
"::",
)
.showHelpAfterError()
.action(async (_, command) => {
Expand All @@ -83,7 +82,8 @@ const startCommand = new Command("start")
.option("-p, --port <PORT>", "Port for the web server", Number, 42069)
.option(
"-H, --hostname <HOSTNAME>",
'Hostname for the web server (default: "0.0.0.0" or "::")',
'Hostname for the web server (default: "::")',
"::",
)
.showHelpAfterError()
.action(async (_, command) => {
Expand All @@ -99,7 +99,8 @@ const serveCommand = new Command("serve")
.option("-p, --port <PORT>", "Port for the web server", Number, 42069)
.option(
"-H, --hostname <HOSTNAME>",
'Hostname for the web server (default: "0.0.0.0" or "::")',
'Hostname for the web server (default: "::")',
"::",
)
.showHelpAfterError()
.action(async (_, command) => {
Expand Down
2 changes: 1 addition & 1 deletion packages/core/src/common/options.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ export type Options = {
logDir: string;

port: number;
hostname?: string;
hostname: string;

telemetryUrl: string;
telemetryDisabled: boolean;
Expand Down
3 changes: 0 additions & 3 deletions packages/core/src/server/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -207,9 +207,6 @@ export async function createServer({
fetch: hono.fetch,
createServer: createServerWithNextAvailablePort,
port,
// Note that common.options.hostname can be undefined if the user did not specify one.
// In this case, Node.js uses `::` if IPv6 is available and `0.0.0.0` otherwise.
// https://nodejs.org/api/net.html#serverlistenport-host-backlog-callback
hostname: common.options.hostname,
},
() => {
Expand Down

0 comments on commit 321a4fe

Please sign in to comment.