Skip to content

Commit e60fcbd

Browse files
mrwuliumrwuliu
authored andcommitted
feat: add configurable port and switch to IPv4 by default
- Add PTY_WEB_PORT env var for fixed port (0 = random) - Change default hostname from ::1 (IPv6) to 127.0.0.1 (IPv4) - Update README with new environment variable
1 parent 3720bcb commit e60fcbd

File tree

2 files changed

+4
-3
lines changed

2 files changed

+4
-3
lines changed

README.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -224,7 +224,8 @@ This eliminates the need for polling—perfect for long-running processes like b
224224
| Variable | Default | Description |
225225
| ---------------------- | ---------- | -------------------------------------------------- |
226226
| `PTY_MAX_BUFFER_LINES` | `50000` | Maximum lines to keep in output buffer per session |
227-
| `PTY_WEB_HOSTNAME` | `::1` | Hostname for the web server to bind to |
227+
| `PTY_WEB_HOSTNAME` | `127.0.0.1`| Hostname for the web server to bind to (IPv4) |
228+
| `PTY_WEB_PORT` | `0` (random) | Port for the web server (0 = random port) |
228229

229230
### Permissions
230231

src/web/server/server.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -41,8 +41,8 @@ export class PTYServer implements Disposable {
4141

4242
private startWebServer(): Server<undefined> {
4343
return Bun.serve({
44-
port: 0,
45-
hostname: process.env.PTY_WEB_HOSTNAME ?? '::1',
44+
port: process.env.PTY_WEB_PORT ? parseInt(process.env.PTY_WEB_PORT, 10) : 0,
45+
hostname: process.env.PTY_WEB_HOSTNAME ?? '127.0.0.1',
4646

4747
routes: {
4848
...this.staticRoutes,

0 commit comments

Comments
 (0)