mirror of
https://github.com/openclaw/openclaw.git
synced 2026-04-03 03:03:24 -04:00
fix: respect OPENCLAW_HOME for isolated gateway instances
When OPENCLAW_HOME is set (indicating an isolated instance), the gateway port should be read from config rather than inheriting OPENCLAW_GATEWAY_PORT from a parent process. This fixes running multiple OpenClaw instances where a child process would incorrectly use the parent's port. Changes: - resolveGatewayPort() now prioritizes config.gateway.port when OPENCLAW_HOME is set - Added getConfigPath() function for runtime-evaluated config path - Deprecated CONFIG_PATH constant with warning about module-load-time evaluation - Updated gateway run command to use getConfigPath() instead of CONFIG_PATH Fixes the issue where spawning a sandbox OpenClaw instance from within another OpenClaw process would fail because OPENCLAW_GATEWAY_PORT from the parent (set in server.impl.ts) would override the child's config.
This commit is contained in:
committed by
Peter Steinberger
parent
4641e452dd
commit
34b18ea9db
@@ -4,7 +4,7 @@ import path from "node:path";
|
||||
import type { GatewayAuthMode } from "../../config/config.js";
|
||||
import type { GatewayWsLogStyle } from "../../gateway/ws-logging.js";
|
||||
import {
|
||||
CONFIG_PATH,
|
||||
getConfigPath,
|
||||
loadConfig,
|
||||
readConfigFileSnapshot,
|
||||
resolveStateDir,
|
||||
@@ -161,7 +161,7 @@ async function runGatewayCommand(opts: GatewayRunOpts) {
|
||||
const tokenRaw = toOptionString(opts.token);
|
||||
|
||||
const snapshot = await readConfigFileSnapshot().catch(() => null);
|
||||
const configExists = snapshot?.exists ?? fs.existsSync(CONFIG_PATH);
|
||||
const configExists = snapshot?.exists ?? fs.existsSync(getConfigPath());
|
||||
const configAuditPath = path.join(resolveStateDir(process.env), "logs", "config-audit.jsonl");
|
||||
const mode = cfg.gateway?.mode;
|
||||
if (!opts.allowUnconfigured && mode !== "local") {
|
||||
|
||||
Reference in New Issue
Block a user