mirror of
https://github.com/openclaw/openclaw.git
synced 2026-05-29 20:45:03 +00:00
refactor: dedupe cli config cron and install flows
This commit is contained in:
@@ -1,5 +1,3 @@
|
||||
import fs from "node:fs/promises";
|
||||
import path from "node:path";
|
||||
import { describe, expect, it } from "vitest";
|
||||
import {
|
||||
getConfigValueAtPath,
|
||||
@@ -8,7 +6,7 @@ import {
|
||||
unsetConfigValueAtPath,
|
||||
} from "./config-paths.js";
|
||||
import { readConfigFileSnapshot, validateConfigObject } from "./config.js";
|
||||
import { buildWebSearchProviderConfig, withTempHome } from "./test-helpers.js";
|
||||
import { buildWebSearchProviderConfig, withTempHome, writeOpenClawConfig } from "./test-helpers.js";
|
||||
import { OpenClawSchema } from "./zod-schema.js";
|
||||
|
||||
describe("$schema key in config (#14998)", () => {
|
||||
@@ -304,16 +302,10 @@ describe("config strict validation", () => {
|
||||
|
||||
it("flags legacy config entries without auto-migrating", async () => {
|
||||
await withTempHome(async (home) => {
|
||||
const configDir = path.join(home, ".openclaw");
|
||||
await fs.mkdir(configDir, { recursive: true });
|
||||
await fs.writeFile(
|
||||
path.join(configDir, "openclaw.json"),
|
||||
JSON.stringify({
|
||||
agents: { list: [{ id: "pi" }] },
|
||||
routing: { allowFrom: ["+15555550123"] },
|
||||
}),
|
||||
"utf-8",
|
||||
);
|
||||
await writeOpenClawConfig(home, {
|
||||
agents: { list: [{ id: "pi" }] },
|
||||
routing: { allowFrom: ["+15555550123"] },
|
||||
});
|
||||
|
||||
const snap = await readConfigFileSnapshot();
|
||||
|
||||
@@ -324,15 +316,9 @@ describe("config strict validation", () => {
|
||||
|
||||
it("does not mark resolved-only gateway.bind aliases as auto-migratable legacy", async () => {
|
||||
await withTempHome(async (home) => {
|
||||
const configDir = path.join(home, ".openclaw");
|
||||
await fs.mkdir(configDir, { recursive: true });
|
||||
await fs.writeFile(
|
||||
path.join(configDir, "openclaw.json"),
|
||||
JSON.stringify({
|
||||
gateway: { bind: "${OPENCLAW_BIND}" },
|
||||
}),
|
||||
"utf-8",
|
||||
);
|
||||
await writeOpenClawConfig(home, {
|
||||
gateway: { bind: "${OPENCLAW_BIND}" },
|
||||
});
|
||||
|
||||
const prev = process.env.OPENCLAW_BIND;
|
||||
process.env.OPENCLAW_BIND = "0.0.0.0";
|
||||
@@ -353,15 +339,9 @@ describe("config strict validation", () => {
|
||||
|
||||
it("still marks literal gateway.bind host aliases as legacy", async () => {
|
||||
await withTempHome(async (home) => {
|
||||
const configDir = path.join(home, ".openclaw");
|
||||
await fs.mkdir(configDir, { recursive: true });
|
||||
await fs.writeFile(
|
||||
path.join(configDir, "openclaw.json"),
|
||||
JSON.stringify({
|
||||
gateway: { bind: "0.0.0.0" },
|
||||
}),
|
||||
"utf-8",
|
||||
);
|
||||
await writeOpenClawConfig(home, {
|
||||
gateway: { bind: "0.0.0.0" },
|
||||
});
|
||||
|
||||
const snap = await readConfigFileSnapshot();
|
||||
expect(snap.valid).toBe(false);
|
||||
|
||||
Reference in New Issue
Block a user