refactor: unify gateway credential planning

This commit is contained in:
Peter Steinberger
2026-03-11 01:37:20 +00:00
parent 3a39dc4e18
commit 5716e52417
6 changed files with 538 additions and 335 deletions

View File

@@ -1,16 +1,10 @@
import type { OpenClawConfig } from "../../config/config.js";
import { resolveGatewayCredentialsFromConfig } from "../../gateway/credentials.js";
import { resolveGatewayDriftCheckCredentialsFromConfig } from "../../gateway/credentials.js";
export function resolveGatewayTokenForDriftCheck(params: {
cfg: OpenClawConfig;
env?: NodeJS.ProcessEnv;
}) {
return resolveGatewayCredentialsFromConfig({
cfg: params.cfg,
env: {} as NodeJS.ProcessEnv,
modeOverride: "local",
// Drift checks should compare the configured local token source against the
// persisted service token, not let exported shell env hide stale service state.
localTokenPrecedence: "config-first",
}).token;
void params.env;
return resolveGatewayDriftCheckCredentialsFromConfig({ cfg: params.cfg }).token;
}