Add DEV_APP_DATA_PATH env var for isolated appdata JSON#2713
Conversation
Allows running the app with a clean appdata file without losing cached server-files (PHP/WP downloads). Set DEV_APP_DATA_PATH to a JSON file path to override only the appdata file location; all other paths (server-files, certificates, thumbnails) continue using the real appData directory. Both the main process (storage/paths.ts) and the CLI child process (cli/lib/appdata.ts) now respect this env var so they write/read from the same file. The start:test script is updated to use this instead of the E2E flags.
📊 Performance Test ResultsComparing 31e211e vs trunk site-editor
site-startup
Results are median values from multiple test runs. Legend: 🟢 Improvement (faster) | 🔴 Regression (slower) | ⚪ No change (<50ms diff) |
ivan-ottinger
left a comment
There was a problem hiding this comment.
I think this is a great idea!
The changes look good to me and work well - I am able to run the app without touching the original appdata JSON file and then switch back to using it again. 👍🏼
Two things:
- the command won't run on Windows at its current form
- maybe we could consider adding the mention to the project documentation
|
@ivan-ottinger thanks for the review.
As this command is purely for development and we don't use Windows as the main machine for development or for keeping our production sites, I think it's okay to keep this one a Mac-only helper.
Makes sense, added. |
Related issues
How AI was used in this PR
AI assisted with implementation. I code reviewed and verified the solution.
Proposed Changes
I propose adding an easy way to quickly start the app for testing, to make screenshots, etc. without touching the appdata file that could include production sites.
DEV_APP_DATA_PATHenv var that overrides the appdata JSON file path in both the main process (storage/paths.ts) and the CLI child process (cli/lib/appdata.ts)start:testscript to useDEV_APP_DATA_PATHinstead of the E2E flags, so the app runs in normal (non-E2E) mode with only the appdata JSON redirectedTesting Instructions
npm run start:test— app starts with a clean appdata at/tmp/studio-test-appdata.json, server-files cache is preservednpm start— app starts with real appdata, unaffectedPre-merge Checklist