diff --git a/README.md b/README.md index 0c299d3..012eba9 100644 --- a/README.md +++ b/README.md @@ -175,7 +175,7 @@ gastown-gui help | Variable | Description | Default | |----------|-------------|---------| | `GASTOWN_PORT` | Server port | 7667 | -| `HOST` | Server host | 127.0.0.1 | +| `GASTOWN_HOST` | Server host | 127.0.0.1 | | `GT_ROOT` | Gas Town root directory | ~/gt | | `GT_BIN` | Override `gt` executable path | auto-detect (`PATH`, `/opt/homebrew/bin/gt`, `/usr/local/bin/gt`) | | `BD_BIN` | Override `bd` executable path | auto-detect (`PATH`, `/opt/homebrew/bin/bd`, `/usr/local/bin/bd`) | diff --git a/bin/cli.js b/bin/cli.js index a2ba8a4..609562e 100755 --- a/bin/cli.js +++ b/bin/cli.js @@ -15,7 +15,7 @@ * * Options: * --port, -p Port to run on (default: 7667) - * --host, -h Host to bind to (default: 127.0.0.1) + * --host, -h Host to bind to (default: 127.0.0.1, or GASTOWN_HOST env var) * --open, -o Open browser after starting * --dev Enable development mode (auto-reload) */ @@ -45,7 +45,7 @@ if (args.includes('--version') || args.includes('-v')) { const command = args.find(a => !a.startsWith('-')) || 'start'; const options = { port: getOption(['--port', '-p']) || process.env.GASTOWN_PORT || '7667', - host: getOption(['--host', '-h']) || process.env.HOST || '127.0.0.1', + host: getOption(['--host', '-h']) || process.env.GASTOWN_HOST || '127.0.0.1', open: hasFlag(['--open', '-o']), dev: hasFlag(['--dev']), }; @@ -79,13 +79,13 @@ Commands: Options: --port, -p Port to run on (default: 7667, or GASTOWN_PORT env var) - --host, -h Host to bind to (default: 127.0.0.1, or HOST env var) + --host, -h Host to bind to (default: 127.0.0.1, or GASTOWN_HOST env var) --open, -o Open browser after starting --dev Enable development mode Environment Variables: GASTOWN_PORT Server port (default: 7667) - HOST Server host (default: 127.0.0.1) + GASTOWN_HOST Server host (default: 127.0.0.1) GT_ROOT Gas Town root directory (default: ~/gt) Examples: @@ -209,7 +209,7 @@ function startServer() { const env = { ...process.env, GASTOWN_PORT: options.port, - HOST: options.host, + GASTOWN_HOST: options.host, }; const serverPath = path.join(packageRoot, 'server.js'); diff --git a/server.js b/server.js index 53737b8..90643c9 100644 --- a/server.js +++ b/server.js @@ -63,7 +63,11 @@ const __filename = fileURLToPath(import.meta.url); const __dirname = path.dirname(__filename); const PORT = process.env.GASTOWN_PORT || 7667; -const HOST = process.env.HOST || '127.0.0.1'; +// Use GASTOWN_HOST (not the bare HOST env var, which collides with the +// compiler-toolchain convention, e.g. HOST=arm64-apple-darwin* set by +// conda/clang cross-compile shells — that would make the server try to bind +// to an unresolvable hostname and crash with getaddrinfo ENOTFOUND). +const HOST = process.env.GASTOWN_HOST || '127.0.0.1'; const HOME = process.env.HOME || os.homedir(); const GT_ROOT = process.env.GT_ROOT || path.join(HOME, 'gt'); const GT_EXECUTABLE = resolveExecutable({ diff --git a/test/integration/cli-compatibility.test.js b/test/integration/cli-compatibility.test.js index 5afff58..114ad1b 100644 --- a/test/integration/cli-compatibility.test.js +++ b/test/integration/cli-compatibility.test.js @@ -63,7 +63,7 @@ async function startRealServerFixture({ gtScript, bdScript, ghScript }) { env: { ...process.env, GASTOWN_PORT: String(port), - HOST: '127.0.0.1', + GASTOWN_HOST: '127.0.0.1', GT_ROOT: gtRoot, PATH: `${binDir}:${process.env.PATH}`, GT_CALL_LOG: gtCallLog, diff --git a/test/integration/cli-executable-resolution.test.js b/test/integration/cli-executable-resolution.test.js index 43f25c3..96bee11 100644 --- a/test/integration/cli-executable-resolution.test.js +++ b/test/integration/cli-executable-resolution.test.js @@ -90,7 +90,7 @@ async function startFixture({ gtScript, bdScript, ghScript, env = {} }) { env: { ...process.env, GASTOWN_PORT: String(port), - HOST: '127.0.0.1', + GASTOWN_HOST: '127.0.0.1', GT_ROOT: gtRoot, PATH: binDir, ...env, diff --git a/test/integration/realtime-cache-invalidation.test.js b/test/integration/realtime-cache-invalidation.test.js index 7f3fab6..bf84e2c 100644 --- a/test/integration/realtime-cache-invalidation.test.js +++ b/test/integration/realtime-cache-invalidation.test.js @@ -187,7 +187,7 @@ exit 1 env: { ...process.env, GASTOWN_PORT: String(port), - HOST: '127.0.0.1', + GASTOWN_HOST: '127.0.0.1', GT_ROOT: gtRoot, PATH: `${binDir}:${process.env.PATH}`, }, diff --git a/test/integration/rig-parsing-fallback.test.js b/test/integration/rig-parsing-fallback.test.js index f34c077..a15b75c 100644 --- a/test/integration/rig-parsing-fallback.test.js +++ b/test/integration/rig-parsing-fallback.test.js @@ -108,7 +108,7 @@ exit 1 env: { ...process.env, GASTOWN_PORT: String(port), - HOST: '127.0.0.1', + GASTOWN_HOST: '127.0.0.1', GT_ROOT: gtRoot, PATH: `${binDir}:${process.env.PATH}`, },