Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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`) |
Expand Down
10 changes: 5 additions & 5 deletions bin/cli.js
Original file line number Diff line number Diff line change
Expand Up @@ -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)
*/
Expand Down Expand Up @@ -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']),
};
Expand Down Expand Up @@ -79,13 +79,13 @@ Commands:

Options:
--port, -p <port> Port to run on (default: 7667, or GASTOWN_PORT env var)
--host, -h <host> Host to bind to (default: 127.0.0.1, or HOST env var)
--host, -h <host> 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:
Expand Down Expand Up @@ -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');
Expand Down
6 changes: 5 additions & 1 deletion server.js
Original file line number Diff line number Diff line change
Expand Up @@ -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({
Expand Down
2 changes: 1 addition & 1 deletion test/integration/cli-compatibility.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
2 changes: 1 addition & 1 deletion test/integration/cli-executable-resolution.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
2 changes: 1 addition & 1 deletion test/integration/realtime-cache-invalidation.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -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}`,
},
Expand Down
2 changes: 1 addition & 1 deletion test/integration/rig-parsing-fallback.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -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}`,
},
Expand Down