Skip to content

Commit 9b50bdd

Browse files
committed
fix: load thread dir env var after server start
Since the THREADS_DIR environment variable is retrieved on package import, changes that dependents make to it before startAppServer is called are ignored. To fix this, load the environment variable immediately before it's used instead. Signed-off-by: Nick Hale <[email protected]>
1 parent 67a41e8 commit 9b50bdd

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

server/app.mjs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,6 @@ const AGENT = 1;
1313
const USER = 2;
1414
const STATE_FILE = "state.json";
1515
const DISABLE_CACHE = process.env.DISABLE_CACHE === "true";
16-
let THREADS_DIR = process.env.THREADS_DIR || "";
1716
let runningScript = null;
1817
let serverRunning = false;
1918

@@ -85,6 +84,7 @@ const mount = async (file, tool, args, workspace, socket, threadID, gptscript) =
8584

8685
let state = {};
8786
let statePath = '';
87+
let THREADS_DIR = process.env.THREADS_DIR
8888
if (!THREADS_DIR) THREADS_DIR = path.join(workspace, "threads");
8989
if (threadID) statePath = path.join(THREADS_DIR, threadID, STATE_FILE);
9090
try {

0 commit comments

Comments
 (0)