diff --git a/src/server/apps.ts b/src/server/apps.ts index 96eee00..b19fee1 100644 --- a/src/server/apps.ts +++ b/src/server/apps.ts @@ -644,9 +644,12 @@ async function runApp(dir: string, port: number) { // Load env vars from TOES_DIR/env/ const appEnv = loadAppEnv(dir, TOES_DIR) + const dataDir = join(process.env.DATA_DIR ?? '.', 'toes', dir) + mkdirSync(dataDir, { recursive: true }) + const proc = Bun.spawn(['bun', 'run', 'toes'], { cwd, - env: { ...process.env, ...appEnv, PORT: String(port), NO_AUTOPORT: 'true', APP_URL: buildAppUrl(dir, TOES_URL), APPS_DIR, DATA_DIR: join(process.env.DATA_DIR ?? '.', 'toes', dir), TOES_DIR, TOES_URL }, + env: { ...process.env, ...appEnv, PORT: String(port), NO_AUTOPORT: 'true', APP_URL: buildAppUrl(dir, TOES_URL), APPS_DIR, DATA_DIR: dataDir, TOES_DIR, TOES_URL }, stdout: 'pipe', stderr: 'pipe', })