Auto-load graph-explorer-config.json on startup#1453
Auto-load graph-explorer-config.json on startup#1453jeremy-london wants to merge 3 commits intoaws:mainfrom
Conversation
|
Sample |
|
Thanks @jeremy-london. On first glance this seems to be a very complete and well considered solution. Given its size and scope it will take some time to review and test out. That said, I'm currently focused on some other items. I'll get to this when I have some time to devote to it. |
Not a problem at all - we have a local build for what we need, and can Manually load as an alternative - just a nice quality of life improvement. Let me know if you need any changes or rebases on my end. |
|
Since it has been a little while, I wanted to let you know that this is still on my list to test out, but hasn't risen to the top just yet. It will be a bit longer. |
No problem! thanks for the updates - let me know when you get into it if any updates or issues come up |
Description
This PR implements automatic loading of
graph-explorer-config.jsonon Graph Explorer startup, similar to howdefaultConnection.jsonis currently auto-loaded. This enables infrastructure-as-code deployments and simplifies Docker-based setups by eliminating the need for manual configuration loading.Key Changes:
Proxy Server (
packages/graph-explorer-proxy-server/src/node-server.ts):GET /graph-explorer-config.jsonto serve the backup config file fromCONFIGURATION_FOLDER_PATHFrontend Auto-Load (
packages/graph-explorer/src/core/StateProvider/autoLoadBackup.ts):autoLoadBackupIfExists()that checks if IndexedDB is emptyGRAPH_EXP_FORCE_LOAD_BACKUP_CONFIGenvironment variable to always load config (overriding IndexedDB)restoreBackup()functionality for consistencyEnvironment Variable (
packages/graph-explorer/src/utils/env.ts):GRAPH_EXP_FORCE_LOAD_BACKUP_CONFIGenvironment variable (defaults tofalse)import.meta.env.GRAPH_EXP_FORCE_LOAD_BACKUP_CONFIGIntegration (
packages/graph-explorer/src/core/StateProvider/storageAtoms.ts):autoLoadBackupIfExists()before atom initializationTests (
packages/graph-explorer/src/core/StateProvider/autoLoadBackup.test.ts):GRAPH_EXP_FORCE_LOAD_BACKUP_CONFIG=trueDocumentation:
README.mdwith new environment variable documentationtroubleshooting.mdfeatures/README.mdwith auto-load informationgetting-started/README.mdChangelog.mdBehavior:
defaultConnection.json→ ✅ Auto-loads (connections only) - already worksgraph-explorer-config.json→ ✅ Auto-loads (full config) when IndexedDB is empty - new behaviorgraph-explorer-config.json→ ✅ Always loads whenGRAPH_EXP_FORCE_LOAD_BACKUP_CONFIG=true- new override optionSafety:
Validation
Manual Testing Steps:
Docker Setup:
Verify Auto-Load (Default Behavior):
gedatabase)Verify Skip Behavior:
Verify Force Load:
GRAPH_EXP_FORCE_LOAD_BACKUP_CONFIG=truein docker-compose.ymlVerify Error Handling:
graph-explorer-config.jsonfileAutomated Tests:
pnpm test packages/graph-explorer/src/core/StateProvider/autoLoadBackup.test.ts- all 11 tests passpnpm testto ensure no regressionspnpm checksto verify code qualityExpected Results:
Related Issues
Fixes #1451
Check List
license.
pnpm checksto ensure code compiles and meets standards.pnpm testto check if all tests are passing.Changelog.md.