fix: unify data directory for dev and prod environments (#116)
Add DATA_DIR env var support to configure the data directory path. All hardcoded resolve(cwd, 'data') paths now use a central getDataDir() function from db-utils.ts that checks DATA_DIR first, falling back to resolve(cwd, 'data'). This prevents local dev (cd backend && npm run dev) from creating a separate backend/data/ directory instead of using the root data/ folder. Changes: - Add getDataDir() to db-utils.ts as single source of truth - Update all 8 source files that reference the data directory - Add dotenv fallback to ../.env for local dev from backend/ - Add DATA_DIR documentation to .env.example - Add 7 new tests for getDataDir and getDbPaths with DATA_DIR - 493 tests pass, TypeScript clean
This commit is contained in:
@@ -13,6 +13,11 @@ PORT=3000
|
||||
CORS_ORIGINS=http://localhost:4174
|
||||
LOG_LEVEL=info
|
||||
|
||||
# Data directory (where database, images, and state files are stored)
|
||||
# Default: ./data relative to process.cwd()
|
||||
# For local dev (cd backend && npm run dev), set to ../data so dev and prod share the same folder
|
||||
# DATA_DIR=../data
|
||||
|
||||
# Timezone for scheduled reminders (e.g., Europe/Berlin, America/New_York)
|
||||
TZ=Europe/Berlin
|
||||
|
||||
|
||||
Reference in New Issue
Block a user