diff --git a/src/config.ts b/src/config.ts index 6c64cb8..da25429 100644 --- a/src/config.ts +++ b/src/config.ts @@ -1,3 +1,4 @@ +import os from 'os'; import path from 'path'; import { readEnvFile } from './env.js'; @@ -19,7 +20,7 @@ export const SCHEDULER_POLL_INTERVAL = 60000; // Absolute paths needed for container mounts const PROJECT_ROOT = process.cwd(); -const HOME_DIR = process.env.HOME || '/Users/user'; +const HOME_DIR = process.env.HOME || os.homedir(); // Mount security: allowlist stored OUTSIDE project root, never mounted into containers export const MOUNT_ALLOWLIST_PATH = path.join( diff --git a/src/mount-security.ts b/src/mount-security.ts index d0d1416..3dceea5 100644 --- a/src/mount-security.ts +++ b/src/mount-security.ts @@ -7,6 +7,7 @@ * Allowlist location: ~/.config/nanoclaw/mount-allowlist.json */ import fs from 'fs'; +import os from 'os'; import path from 'path'; import pino from 'pino'; @@ -121,7 +122,7 @@ export function loadMountAllowlist(): MountAllowlist | null { * Expand ~ to home directory and resolve to absolute path */ function expandPath(p: string): string { - const homeDir = process.env.HOME || '/Users/user'; + const homeDir = process.env.HOME || os.homedir(); if (p.startsWith('~/')) { return path.join(homeDir, p.slice(2)); }