Fix agent API URL injection for auto-selected server ports

This commit is contained in:
Dotta
2026-03-03 13:13:47 -06:00
parent 2e4481fc26
commit 778fc3416f
3 changed files with 78 additions and 1 deletions

View File

@@ -434,6 +434,15 @@ if (listenPort !== config.port) {
logger.warn(`Requested port is busy; using next free port (requestedPort=${config.port}, selectedPort=${listenPort})`);
}
const runtimeListenHost = config.host;
const runtimeApiHost =
runtimeListenHost === "0.0.0.0" || runtimeListenHost === "::"
? "localhost"
: runtimeListenHost;
process.env.PAPERCLIP_LISTEN_HOST = runtimeListenHost;
process.env.PAPERCLIP_LISTEN_PORT = String(listenPort);
process.env.PAPERCLIP_API_URL = `http://${runtimeApiHost}:${listenPort}`;
setupLiveEventsWebSocketServer(server, db as any, {
deploymentMode: config.deploymentMode,
resolveSessionFromHeaders,