fix(config): fall back to skeleton when config dir is read-only#6810
Closed
emanuelbesliu wants to merge 1 commit into
Closed
fix(config): fall back to skeleton when config dir is read-only#6810emanuelbesliu wants to merge 1 commit into
emanuelbesliu wants to merge 1 commit into
Conversation
Homepage hard-crashes with process.exit(1) when it cannot copy a default config file into the config directory. This happens whenever the config directory is read-only and only some files are present — most commonly when individual files are mounted via subPath from a Kubernetes ConfigMap, which makes the directory non-writable. Missing skeleton files then trigger an EACCES/EROFS copyfile error and take the whole app down with CrashLoopBackOff. Instead of exiting, checkAndCopyConfig now warns and continues, and all config readers resolve their path through a new getConfigPath() helper that prefers the user's config file but falls back to the bundled src/skeleton copy when the file is absent. The skeletons are valid (mostly-commented) YAML, so Homepage starts cleanly with whatever subset of config files the user provided. Refs gethomepage#2040, gethomepage#2172 Signed-off-by: Emanuel Besliu <32497562+emanuelbesliu@users.noreply.github.com> Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Contributor
|
This pull request was automatically closed because it matched multiple low-quality or automated-PR signals. |
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## dev #6810 +/- ##
=======================================
Coverage 81.43% 81.43%
=======================================
Files 532 532
Lines 9581 9583 +2
Branches 1797 1797
=======================================
+ Hits 7802 7804 +2
Misses 1079 1079
Partials 700 700
Flags with carried forward coverage won't be shown. Click here to find out more.
🚀 New features to boost your workflow:
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
ASLOP-PR-VERIFY
Proposed change
Homepage hard-crashes with
process.exit(1)when it cannot copy a default config file into the config directory. This happens whenever the config directory is read-only and only some files are present — most commonly when individual files are mounted viasubPathfrom a Kubernetes ConfigMap, which makes the directory non-writable. Any missing skeleton file then triggers anEACCES/EROFScopyfile error and takes the whole app down withCrashLoopBackOff.This PR makes config loading resilient to a read-only config directory:
checkAndCopyConfig()now warns and continues instead of callingprocess.exit(1)when it cannot seed a default file.getConfigPath()helper resolves each config read to the user's file when present, and falls back to the bundledsrc/skeleton/copy when it is absent. The skeletons are valid (mostly-commented) YAML/CSS/JS, so Homepage starts cleanly with whatever subset of config files the user provided.settings,services,docker,widgets,bookmarks,kubernetes,proxmox, and the/api/hashroute) now read throughgetConfigPath().This matches the direction discussed by the community in the referenced issues — avoid requiring writes to the config directory in the first place, and fall back to the skeleton.
Closes #2172
Refs #2040
Type of change
Checklist:
Tests
config.check-copy.test.js: replaced the "exits the process when copying fails" test with one asserting that anEROFScopy failure now warns and continues (noprocess.exit), plus newgetConfigPathtests (config-dir hit and skeleton fallback).getConfigPathto the existing mocks inwidget-helpers,docker,service-helpers,api-response,kubernetes,proxmox, andhashtest suites.devcheckout and are unrelated to this change.eslintis clean on all touched files.AI tool disclosure
This change was developed with AI-assisted tooling (GitHub Copilot CLI). The diagnosis, design (skeleton fallback rather than forcing a writable config dir), code, and tests were human-reviewed and verified locally before submission.