refactor!: drop legacy CLAWDBOT env compatibility

This commit is contained in:
Peter Steinberger
2026-03-22 22:13:01 -07:00
parent 5ff60cc39f
commit 6b9915a106
85 changed files with 148 additions and 569 deletions

View File

@@ -183,9 +183,7 @@ function parsePositiveInteger(raw: string | undefined): number | null {
}
function resolveGatewayPort(cfg: OpenClawPluginApi["config"]): number {
const envPort =
parsePositiveInteger(process.env.OPENCLAW_GATEWAY_PORT?.trim()) ??
parsePositiveInteger(process.env.CLAWDBOT_GATEWAY_PORT?.trim());
const envPort = parsePositiveInteger(process.env.OPENCLAW_GATEWAY_PORT?.trim());
if (envPort) {
return envPort;
}
@@ -290,17 +288,10 @@ async function resolveTailnetHost(): Promise<string | null> {
function resolveAuthLabel(cfg: OpenClawPluginApi["config"]): ResolveAuthLabelResult {
const mode = cfg.gateway?.auth?.mode;
const token =
pickFirstDefined([
process.env.OPENCLAW_GATEWAY_TOKEN,
process.env.CLAWDBOT_GATEWAY_TOKEN,
cfg.gateway?.auth?.token,
]) ?? undefined;
pickFirstDefined([process.env.OPENCLAW_GATEWAY_TOKEN, cfg.gateway?.auth?.token]) ?? undefined;
const password =
pickFirstDefined([
process.env.OPENCLAW_GATEWAY_PASSWORD,
process.env.CLAWDBOT_GATEWAY_PASSWORD,
cfg.gateway?.auth?.password,
]) ?? undefined;
pickFirstDefined([process.env.OPENCLAW_GATEWAY_PASSWORD, cfg.gateway?.auth?.password]) ??
undefined;
if (mode === "token" || mode === "password") {
return resolveRequiredAuthLabel(mode, { token, password });

View File

@@ -41,9 +41,8 @@ beforeEach(() => {
}) => {
const configToken = params.config?.gateway?.auth?.token;
const configPassword = params.config?.gateway?.auth?.password;
const envToken = params.env.OPENCLAW_GATEWAY_TOKEN ?? params.env.CLAWDBOT_GATEWAY_TOKEN;
const envPassword =
params.env.OPENCLAW_GATEWAY_PASSWORD ?? params.env.CLAWDBOT_GATEWAY_PASSWORD;
const envToken = params.env.OPENCLAW_GATEWAY_TOKEN;
const envPassword = params.env.OPENCLAW_GATEWAY_PASSWORD;
return { token: envToken ?? configToken, password: envPassword ?? configPassword };
},
);

View File

@@ -21,7 +21,7 @@ const processingClaims = createDedupeCache({
});
function resolveStateDirFromEnv(env: NodeJS.ProcessEnv = process.env): string {
const stateOverride = env.OPENCLAW_STATE_DIR?.trim() || env.CLAWDBOT_STATE_DIR?.trim();
const stateOverride = env.OPENCLAW_STATE_DIR?.trim();
if (stateOverride) {
return stateOverride;
}

View File

@@ -190,9 +190,7 @@ async function restoreIndexedDatabases(snapshot: IdbDatabaseSnapshot[]): Promise
function resolveDefaultIdbSnapshotPath(): string {
const stateDir =
process.env.OPENCLAW_STATE_DIR ||
process.env.MOLTBOT_STATE_DIR ||
path.join(process.env.HOME || "/tmp", ".openclaw");
process.env.OPENCLAW_STATE_DIR || path.join(process.env.HOME || "/tmp", ".openclaw");
return path.join(stateDir, "matrix", "crypto-idb-snapshot.json");
}

View File

@@ -18,7 +18,7 @@ async function withTempStateDir<T>(fn: (dir: string) => Promise<T>) {
state: {
resolveStateDir: (env, homedir) => {
const stateEnv = env ?? process.env;
const override = stateEnv.OPENCLAW_STATE_DIR?.trim() || stateEnv.CLAWDBOT_STATE_DIR?.trim();
const override = stateEnv.OPENCLAW_STATE_DIR?.trim();
if (override) {
return override;
}