mirror of
https://github.com/openclaw/openclaw.git
synced 2026-05-04 12:40:28 +00:00
refactor: dedupe gateway and flow string helpers
This commit is contained in:
@@ -2,7 +2,7 @@ import type { Command } from "commander";
|
||||
import qrcode from "qrcode-terminal";
|
||||
import { loadConfig } from "../config/config.js";
|
||||
import { hasConfiguredSecretInput } from "../config/types.secrets.js";
|
||||
import { readGatewayPasswordEnv, readGatewayTokenEnv } from "../gateway/credentials.js";
|
||||
import { trimToUndefined } from "../gateway/credentials.js";
|
||||
import { resolveRequiredConfiguredSecretRefInputString } from "../gateway/resolve-configured-secret-input-string.js";
|
||||
import { resolvePairingSetupFromConfig, encodePairingSetupCode } from "../pairing/setup-code.js";
|
||||
import { runCommandWithTimeout } from "../process/exec.js";
|
||||
@@ -44,7 +44,7 @@ function shouldResolveLocalGatewayPasswordSecret(
|
||||
cfg: ReturnType<typeof loadConfig>,
|
||||
env: NodeJS.ProcessEnv,
|
||||
): boolean {
|
||||
if (readGatewayPasswordEnv(env)) {
|
||||
if (trimToUndefined(env.OPENCLAW_GATEWAY_PASSWORD)) {
|
||||
return false;
|
||||
}
|
||||
const authMode = cfg.gateway?.auth?.mode;
|
||||
@@ -54,7 +54,7 @@ function shouldResolveLocalGatewayPasswordSecret(
|
||||
if (authMode === "token" || authMode === "none" || authMode === "trusted-proxy") {
|
||||
return false;
|
||||
}
|
||||
const envToken = readGatewayTokenEnv(env);
|
||||
const envToken = trimToUndefined(env.OPENCLAW_GATEWAY_TOKEN);
|
||||
const configTokenConfigured = hasConfiguredSecretInput(
|
||||
cfg.gateway?.auth?.token,
|
||||
cfg.secrets?.defaults,
|
||||
|
||||
Reference in New Issue
Block a user