mirror of
https://github.com/openclaw/openclaw.git
synced 2026-05-05 15:10:22 +00:00
fix: harden Docker/GCP onboarding flow (#26253) (thanks @pandego)
This commit is contained in:
@@ -168,6 +168,27 @@ describe("docker-setup.sh", () => {
|
||||
expect(identityDirStat.isDirectory()).toBe(true);
|
||||
});
|
||||
|
||||
it("reuses existing config token when OPENCLAW_GATEWAY_TOKEN is unset", async () => {
|
||||
const activeSandbox = requireSandbox(sandbox);
|
||||
const configDir = join(activeSandbox.rootDir, "config-token-reuse");
|
||||
const workspaceDir = join(activeSandbox.rootDir, "workspace-token-reuse");
|
||||
await mkdir(configDir, { recursive: true });
|
||||
await writeFile(
|
||||
join(configDir, "openclaw.json"),
|
||||
JSON.stringify({ gateway: { auth: { mode: "token", token: "config-token-123" } } }),
|
||||
);
|
||||
|
||||
const result = runDockerSetup(activeSandbox, {
|
||||
OPENCLAW_GATEWAY_TOKEN: undefined,
|
||||
OPENCLAW_CONFIG_DIR: configDir,
|
||||
OPENCLAW_WORKSPACE_DIR: workspaceDir,
|
||||
});
|
||||
|
||||
expect(result.status).toBe(0);
|
||||
const envFile = await readFile(join(activeSandbox.rootDir, ".env"), "utf8");
|
||||
expect(envFile).toContain("OPENCLAW_GATEWAY_TOKEN=config-token-123");
|
||||
});
|
||||
|
||||
it("rejects injected multiline OPENCLAW_EXTRA_MOUNTS values", async () => {
|
||||
const activeSandbox = requireSandbox(sandbox);
|
||||
|
||||
|
||||
@@ -9,7 +9,7 @@ const dockerfilePath = join(repoRoot, "Dockerfile");
|
||||
describe("Dockerfile", () => {
|
||||
it("installs optional browser dependencies after pnpm install", async () => {
|
||||
const dockerfile = await readFile(dockerfilePath, "utf8");
|
||||
const installIndex = dockerfile.indexOf("RUN pnpm install --frozen-lockfile");
|
||||
const installIndex = dockerfile.indexOf("pnpm install --frozen-lockfile");
|
||||
const browserArgIndex = dockerfile.indexOf("ARG OPENCLAW_INSTALL_BROWSER");
|
||||
|
||||
expect(installIndex).toBeGreaterThan(-1);
|
||||
|
||||
Reference in New Issue
Block a user