Derive backup directory from KIAUH install root in BackupService#779
Closed
itdir wants to merge 13 commits intodw-0:masterfrom
Closed
Derive backup directory from KIAUH install root in BackupService#779itdir wants to merge 13 commits intodw-0:masterfrom
itdir wants to merge 13 commits intodw-0:masterfrom
Conversation
Update backup root initialization to use the path of the Kiauh root directory instead of only using home directory.
…ASE_DIR env var Introduces a centralized BASE_DIR constant in core/constants.py that reads from the KIAUH_BASE_DIR environment variable, defaulting to Path.home(). All component and extension directory constants now use BASE_DIR instead of hardcoded Path.home() calls, enabling system-wide installs to /opt/*, /srv/*, or any custom location. Co-authored-by: itdir <41797199+itdir@users.noreply.github.com>
…rity Co-authored-by: itdir <41797199+itdir@users.noreply.github.com>
…tory fallbacks - Validate KIAUH_BASE_DIR: empty, whitespace-only, or relative paths safely fall back to Path.home() instead of producing unexpected behavior - set_nginx_permissions(): always check home directory permissions (upstream behavior) plus BASE_DIR when it differs, since NGINX needs traversal access - Backup fallback search: search both Path.home() and BASE_DIR when they differ, ensuring existing home-directory installs are always found Co-authored-by: itdir <41797199+itdir@users.noreply.github.com>
Co-authored-by: itdir <41797199+itdir@users.noreply.github.com>
…ctory with full proposal - Enhance BASE_DIR resolution: env var > kiauh.cfg > Path.home() - Add base_dir to AppSettings and KiauhSettings for persistence - Add base_dir option to default.kiauh.cfg (commented, self-documenting) - Add startup logging when non-default base dir is active - Create docs/proposal-configurable-base-dir.md with full analysis, SWOT, pros/cons, migration guide, and justification for upstream maintainers Co-authored-by: itdir <41797199+itdir@users.noreply.github.com>
…oject_root validation, config example Co-authored-by: itdir <41797199+itdir@users.noreply.github.com>
Configurable base directory with settings integration and upstream proposal
…E_DIR env var Squashed commits: - b9d030f Initial plan - 8336ecd Replace hardcoded Path.home() with configurable BASE_DIR from KIAUH_BASE_DIR env var - 7e3efd5 Address code review: fix fd leak in tempfile, rename variable for clarity - c2aac00 Ensure backward compatibility: validate BASE_DIR, preserve home directory fallbacks - 817406a Address code review: use shlex.quote for shell safety, use set for dedup - a5bb03f Comprehensive alternative: settings-integrated configurable base directory with full proposal - 2eabc25 Address code review: module-level imports, dual separator support, project_root validation, config example
settings-integrated configurable base directory with full justification
Owner
|
closed in favor of #780 |
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.
Summary
kiauh_backupsas a sibling directory to the repo.Path.home()if repo root markers are not found.Motivation
KIAUH is often installed outside the user’s home directory (e.g.,
/opt/kiauh). The current backup path always uses~/kiauh_backups, which separates backups from the install location and can introduce permissions or maintenance issues, especially in environments with multiple admins. This change keeps backups colocated with the install root while keeping the existing default for unexpected layouts.Implementation
_get_kiauh_root()to locate the repo root by searching parent directories forkiauh.shanddefault.kiauh.cfg.backup_rootto<kiauh_root>/../kiauh_backups.Path.home()if markers are not found.Testing
/opt/kiauh→ backups in/opt/kiauh_backups.~/kiauh→ backups in~/kiauh_backups.