fix(server): use home-based path for run logs instead of cwd
Run logs defaulted to process.cwd()/data/run-logs, placing logs in unexpected locations when launched from non-home directories. Now defaults to ~/.paperclip/instances/<id>/data/run-logs/. Fixes #89 Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
parent
63a876ca3c
commit
3f2274cd8d
1 changed files with 2 additions and 1 deletions
|
|
@ -2,6 +2,7 @@ import { createReadStream, promises as fs } from "node:fs";
|
|||
import path from "node:path";
|
||||
import { createHash } from "node:crypto";
|
||||
import { notFound } from "../errors.js";
|
||||
import { resolvePaperclipInstanceRoot } from "../home-paths.js";
|
||||
|
||||
export type RunLogStoreType = "local_file";
|
||||
|
||||
|
|
@ -148,7 +149,7 @@ let cachedStore: RunLogStore | null = null;
|
|||
|
||||
export function getRunLogStore() {
|
||||
if (cachedStore) return cachedStore;
|
||||
const basePath = process.env.RUN_LOG_BASE_PATH ?? path.resolve(process.cwd(), "data/run-logs");
|
||||
const basePath = process.env.RUN_LOG_BASE_PATH ?? path.resolve(resolvePaperclipInstanceRoot(), "data", "run-logs");
|
||||
cachedStore = createLocalFileRunLogStore(basePath);
|
||||
return cachedStore;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue