Fix hardcoded paths with environment variable support#104
Open
xingzihai wants to merge 1 commit intomvanhorn:mainfrom
Open
Fix hardcoded paths with environment variable support#104xingzihai wants to merge 1 commit intomvanhorn:mainfrom
xingzihai wants to merge 1 commit intomvanhorn:mainfrom
Conversation
- Add centralized path configuration in env.py with XDG-compliant defaults - Support environment variable overrides for all paths: - LAST30DAYS_CONFIG_DIR for config directory - LAST30DAYS_DATA_DIR for data directory - LAST30DAYS_DATABASE_PATH for database file - LAST30DAYS_CACHE_DIR for cache directory - LAST30DAYS_OUTPUT_DIR for output directory - LAST30DAYS_BRIEFS_DIR for briefs directory - Update all modules to use centralized path functions - Update UI to dynamically show actual config paths - Add fallback to temp directories when permission denied - Update README.md with path customization documentation This allows users to customize storage locations for different deployment environments (containers, shared systems, etc.)
Owner
|
See my reply on #109 covering all your PRs. Can't commit to anything right now with the v3.0 refactor underway, but I promise I'll consider each one once it lands. Appreciate the work. |
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
This PR fixes hardcoded path issues throughout the codebase by implementing a centralized path configuration system with environment variable support.
Changes
Core Path Configuration (
scripts/lib/env.py)Environment Variables Supported
LAST30DAYS_CONFIG_DIR~/.config/last30daysLAST30DAYS_DATA_DIR~/.local/share/last30daysLAST30DAYS_DATABASE_PATH{DATA_DIR}/research.dbLAST30DAYS_CACHE_DIR~/.cache/last30daysLAST30DAYS_OUTPUT_DIR~/.local/share/last30days/outLAST30DAYS_BRIEFS_DIR~/.local/share/last30days/briefsFiles Modified
scripts/lib/env.py- Added path configuration functionsscripts/store.py- Updated to useget_database_path()scripts/lib/cache.py- Updated to useget_cache_dir()scripts/lib/render.py- Updated to useget_output_dir()scripts/last30days.py- Updated help string for--storescripts/lib/ui.py- Updated to dynamically show config pathsscripts/briefing.py- Updated to useget_briefs_dir()README.md- Added path customization documentationBenefits
Testing
All modified Python files compile successfully without errors.