refactor: dedupe auth session readers

This commit is contained in:
Peter Steinberger
2026-04-07 05:29:28 +01:00
parent 21802f750f
commit 9869941c06
12 changed files with 43 additions and 27 deletions

View File

@@ -8,6 +8,7 @@ import {
signalVerifiedGatewayPidSync,
} from "../../infra/gateway-processes.js";
import { defaultRuntime } from "../../runtime.js";
import { normalizeOptionalString } from "../../shared/string-coerce.js";
import { theme } from "../../terminal/theme.js";
import { formatCliCommand } from "../command-format.js";
import { recoverInstalledLaunchAgent } from "./launchd-recovery.js";
@@ -77,8 +78,8 @@ async function assertUnmanagedGatewayRestartEnabled(port: number): Promise<void>
const probe = await probeGateway({
url: `${scheme}://127.0.0.1:${port}`,
auth: {
token: process.env.OPENCLAW_GATEWAY_TOKEN?.trim() || undefined,
password: process.env.OPENCLAW_GATEWAY_PASSWORD?.trim() || undefined,
token: normalizeOptionalString(process.env.OPENCLAW_GATEWAY_TOKEN),
password: normalizeOptionalString(process.env.OPENCLAW_GATEWAY_PASSWORD),
},
timeoutMs: 1_000,
}).catch(() => null);