mirror of
https://github.com/openclaw/openclaw.git
synced 2026-07-03 11:33:40 +00:00
* fix(cron): run legacy cron store migration in gateway fast path * fix(cli): run gateway startup migrations * fix(gateway): guard startup migrations and config selection * fix(gateway): reconcile final startup environment * fix(gateway): preserve guarded startup env semantics * fix(gateway): guard service-mode recovery candidates * fix(config): reconcile normalized env precedence * fix(cli): clear replaced proxy signal handlers * fix(gateway): reject invalid final config * test(gateway): cover invalid future config reset guard * test(cli): remove unused recovery state
73 lines
1.7 KiB
TypeScript
73 lines
1.7 KiB
TypeScript
// Source-aware gateway run option resolution shared by pre-action and runtime startup.
|
|
import type { Command } from "commander";
|
|
import { inheritOptionFromParent } from "../command-options.js";
|
|
|
|
export type GatewayRunOpts = {
|
|
port?: unknown;
|
|
bind?: unknown;
|
|
token?: unknown;
|
|
auth?: unknown;
|
|
password?: unknown;
|
|
passwordFile?: unknown;
|
|
tailscale?: unknown;
|
|
tailscaleResetOnExit?: boolean;
|
|
allowUnconfigured?: boolean;
|
|
force?: boolean;
|
|
verbose?: boolean;
|
|
cliBackendLogs?: boolean;
|
|
/** @deprecated Use cliBackendLogs. */
|
|
claudeCliLogs?: boolean;
|
|
wsLog?: unknown;
|
|
compact?: boolean;
|
|
rawStream?: boolean;
|
|
rawStreamPath?: unknown;
|
|
dev?: boolean;
|
|
reset?: boolean;
|
|
};
|
|
|
|
const GATEWAY_RUN_VALUE_KEYS = [
|
|
"port",
|
|
"bind",
|
|
"token",
|
|
"auth",
|
|
"password",
|
|
"passwordFile",
|
|
"tailscale",
|
|
"wsLog",
|
|
"rawStreamPath",
|
|
] as const;
|
|
|
|
const GATEWAY_RUN_BOOLEAN_KEYS = [
|
|
"tailscaleResetOnExit",
|
|
"allowUnconfigured",
|
|
"dev",
|
|
"reset",
|
|
"force",
|
|
"verbose",
|
|
"cliBackendLogs",
|
|
"claudeCliLogs",
|
|
"compact",
|
|
"rawStream",
|
|
] as const;
|
|
|
|
export function resolveGatewayRunOptions(opts: GatewayRunOpts, command?: Command): GatewayRunOpts {
|
|
const resolved: GatewayRunOpts = { ...opts };
|
|
|
|
for (const key of GATEWAY_RUN_VALUE_KEYS) {
|
|
const inherited = inheritOptionFromParent(command, key);
|
|
if (key === "wsLog") {
|
|
// wsLog has a child default ("auto"), so prefer inherited parent CLI value when present.
|
|
resolved[key] = inherited ?? resolved[key];
|
|
continue;
|
|
}
|
|
resolved[key] = resolved[key] ?? inherited;
|
|
}
|
|
|
|
for (const key of GATEWAY_RUN_BOOLEAN_KEYS) {
|
|
const inherited = inheritOptionFromParent<boolean>(command, key);
|
|
resolved[key] = Boolean(resolved[key] || inherited);
|
|
}
|
|
|
|
return resolved;
|
|
}
|