mirror of
https://github.com/openclaw/openclaw.git
synced 2026-05-06 18:40:44 +00:00
test(onboard): satisfy gateway token lint
This commit is contained in:
committed by
Gustavo Madeira Santana
parent
8c188f4607
commit
39d18a4b86
@@ -9,9 +9,13 @@ import { applyNonInteractiveGatewayConfig } from "./gateway-config.js";
|
||||
const randomToken = vi.hoisted(() => vi.fn(() => "generated-random-token"));
|
||||
vi.mock("../../onboard-helpers.js", () => ({
|
||||
normalizeGatewayTokenInput: (value: unknown): string => {
|
||||
if (typeof value !== "string") return "";
|
||||
if (typeof value !== "string") {
|
||||
return "";
|
||||
}
|
||||
const trimmed = value.trim();
|
||||
if (trimmed === "undefined" || trimmed === "null") return "";
|
||||
if (trimmed === "undefined" || trimmed === "null") {
|
||||
return "";
|
||||
}
|
||||
return trimmed;
|
||||
},
|
||||
randomToken,
|
||||
|
||||
@@ -64,8 +64,7 @@ export function applyNonInteractiveGatewayConfig(params: {
|
||||
// plaintext > ambient OPENCLAW_GATEWAY_TOKEN > randomToken(). Ambient env
|
||||
// must not rotate a token already written to disk — a stale shell or
|
||||
// launchd env var otherwise breaks already-paired clients.
|
||||
let gatewayToken =
|
||||
explicitGatewayToken || existingPlaintextToken || envGatewayToken || undefined;
|
||||
let gatewayToken = explicitGatewayToken || existingPlaintextToken || envGatewayToken || undefined;
|
||||
const gatewayTokenRefEnv = normalizeOptionalString(opts.gatewayTokenRefEnv ?? "") ?? "";
|
||||
|
||||
if (authMode === "token") {
|
||||
|
||||
Reference in New Issue
Block a user