feat: support configurable gateway port

This commit is contained in:
Peter Steinberger
2026-01-03 12:00:17 +01:00
parent 7199813969
commit f47c7ac369
23 changed files with 172 additions and 46 deletions

View File

@@ -1,5 +1,5 @@
import { randomUUID } from "node:crypto";
import { loadConfig } from "../config/config.js";
import { loadConfig, resolveGatewayPort } from "../config/config.js";
import { GatewayClient } from "./client.js";
import { PROTOCOL_VERSION } from "./protocol/index.js";
@@ -28,6 +28,7 @@ export async function callGateway<T = unknown>(
const isRemoteMode = config.gateway?.mode === "remote";
const remote = isRemoteMode ? config.gateway?.remote : undefined;
const authToken = config.gateway?.auth?.token;
const localPort = resolveGatewayPort(config);
const url =
(typeof opts.url === "string" && opts.url.trim().length > 0
? opts.url.trim()
@@ -35,7 +36,7 @@ export async function callGateway<T = unknown>(
(typeof remote?.url === "string" && remote.url.trim().length > 0
? remote.url.trim()
: undefined) ||
"ws://127.0.0.1:18789";
`ws://127.0.0.1:${localPort}`;
const token =
(typeof opts.token === "string" && opts.token.trim().length > 0
? opts.token.trim()