mirror of
https://github.com/openclaw/openclaw.git
synced 2026-04-17 04:01:05 +00:00
refactor: dedupe setup token readers
This commit is contained in:
@@ -8,6 +8,7 @@ import {
|
||||
type PortUsage,
|
||||
} from "../../infra/ports.js";
|
||||
import { killProcessTree } from "../../process/kill-tree.js";
|
||||
import { normalizeOptionalString } from "../../shared/string-coerce.js";
|
||||
import { sleep } from "../../utils.js";
|
||||
|
||||
export const DEFAULT_RESTART_HEALTH_TIMEOUT_MS = 60_000;
|
||||
@@ -66,8 +67,8 @@ function looksLikeAuthClose(code: number | undefined, reason: string | undefined
|
||||
}
|
||||
|
||||
async function confirmGatewayReachable(port: number): Promise<boolean> {
|
||||
const token = process.env.OPENCLAW_GATEWAY_TOKEN?.trim() || undefined;
|
||||
const password = process.env.OPENCLAW_GATEWAY_PASSWORD?.trim() || undefined;
|
||||
const token = normalizeOptionalString(process.env.OPENCLAW_GATEWAY_TOKEN);
|
||||
const password = normalizeOptionalString(process.env.OPENCLAW_GATEWAY_PASSWORD);
|
||||
const probe = await probeGateway({
|
||||
url: `ws://127.0.0.1:${port}`,
|
||||
auth: token || password ? { token, password } : undefined,
|
||||
|
||||
Reference in New Issue
Block a user