mirror of
https://github.com/openclaw/openclaw.git
synced 2026-05-05 17:30:21 +00:00
refactor!: drop legacy CLAWDBOT env compatibility
This commit is contained in:
@@ -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 });
|
||||
|
||||
@@ -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 };
|
||||
},
|
||||
);
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
@@ -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");
|
||||
}
|
||||
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user