set allowed origins

This commit is contained in:
Arjun Komath
2026-03-03 19:13:11 +11:00
parent 1b5c68c30a
commit d0953e5eec
+23
View File
@@ -148,6 +148,28 @@ function isConfigured() {
}
}
async function syncAllowedOrigins() {
const publicDomain = process.env.RAILWAY_PUBLIC_DOMAIN;
if (!publicDomain) return;
const origin = `https://${publicDomain}`;
const result = await runCmd(
OPENCLAW_NODE,
clawArgs([
"config",
"set",
"--json",
"gateway.controlUi.allowedOrigins",
JSON.stringify([origin]),
]),
);
if (result.code === 0) {
log.info("gateway", `set allowedOrigins to [${origin}]`);
} else {
log.warn("gateway", `failed to set allowedOrigins (exit=${result.code})`);
}
}
let gatewayProc = null;
let gatewayStarting = null;
let shuttingDown = false;
@@ -264,6 +286,7 @@ async function ensureGatewayRunning() {
if (!ready) {
throw new Error("Gateway did not become ready in time");
}
await syncAllowedOrigins();
})().finally(() => {
gatewayStarting = null;
});