Skip to content

fix: read GASTOWN_HOST instead of bare HOST env var#32

Open
Ljferrer wants to merge 1 commit into
web3dev1337:masterfrom
Ljferrer:fix/gastown-host-env-collision
Open

fix: read GASTOWN_HOST instead of bare HOST env var#32
Ljferrer wants to merge 1 commit into
web3dev1337:masterfrom
Ljferrer:fix/gastown-host-env-collision

Conversation

@Ljferrer
Copy link
Copy Markdown

The server and CLI read process.env.HOST to determine the bind address. HOST is also the standard compiler-toolchain target-triple variable (set by conda/clang cross-compile shells, e.g. HOST=arm64-apple-darwin20.0.0). In such a shell the server tries to bind to that value as a hostname and crashes on startup:

Error: getaddrinfo ENOTFOUND arm64-apple-darwin20.0.0
Emitted 'error' event on WebSocketServer instance

Switch to a namespaced GASTOWN_HOST env var, mirroring the existing GASTOWN_PORT convention, so the GUI no longer collides with the toolchain HOST variable. The --host CLI flag is unchanged.

  • server.js: read GASTOWN_HOST (with explanatory comment)
  • bin/cli.js: read GASTOWN_HOST, pass it to the spawned server, update help/docs
  • README.md: document GASTOWN_HOST
  • test/integration: update spawned-server env to GASTOWN_HOST

Verified: with HOST=arm64-apple-darwin20.0.0 set and GASTOWN_HOST unset, the server now binds to 127.0.0.1 and serves 200. Full suite green (343/343).

The server and CLI read `process.env.HOST` to determine the bind
address. `HOST` is also the standard compiler-toolchain target-triple
variable (set by conda/clang cross-compile shells, e.g.
`HOST=arm64-apple-darwin20.0.0`). In such a shell the server tries to
bind to that value as a hostname and crashes on startup:

    Error: getaddrinfo ENOTFOUND arm64-apple-darwin20.0.0
    Emitted 'error' event on WebSocketServer instance

Switch to a namespaced `GASTOWN_HOST` env var, mirroring the existing
`GASTOWN_PORT` convention, so the GUI no longer collides with the
toolchain `HOST` variable. The `--host` CLI flag is unchanged.

- server.js: read GASTOWN_HOST (with explanatory comment)
- bin/cli.js: read GASTOWN_HOST, pass it to the spawned server, update help/docs
- README.md: document GASTOWN_HOST
- test/integration: update spawned-server env to GASTOWN_HOST

Verified: with HOST=arm64-apple-darwin20.0.0 set and GASTOWN_HOST unset,
the server now binds to 127.0.0.1 and serves 200. Full suite green (343/343).
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants