Repository navigation
Allow configuring the root folder for file driver redirects - #47
andreasbergqvist wants to merge 4 commits into
Conversation
Co-authored-by: Copilot App <[email protected]>
Co-authored-by: andreasbergqvist <[email protected]>
Alt-Charlie
left a comment
There was a problem hiding this comment.
Hey @andreasbergqvist thanks for this, it's a useful option and sorry for the wait. I've tested it with relative and absolute paths, and redirects, regex redirects, query strings and the install marker all end up in the configured folder as expected. A few things before we merge:
1. The new test fails
it can set custom root path in configuration returns a 404 instead of a 301. The test saves through a new FileRepository, but the middleware gets its repository from the RepositoryManager singleton. That manager already created the file driver during boot with the default path, so the request looks in content/alt-redirect. Calling app(RepositoryManager::class)->forgetDrivers() after changing the config, then saving through app(RepositoryInterface::class), makes it pass and tests the same path the middleware uses.
2. Documentation
Could you add the new option to the README? The storage section still says files live in content/alt-redirect/.
Hope that makes sense. Any questions or alternative thoughts please let me know!
Co-authored-by: Copilot App <[email protected]>
Co-authored-by: Copilot App <[email protected]>
This pull request adds support for customizing the root directory where redirect and query string YAML files are stored when using the "file" driver. All file operations within the
FileRepositoryand related classes now use the configurableroot_pathinstead of a hardcoded path, improving flexibility and maintainability. Tests have also been updated and extended to verify this new behavior.Configuration changes:
root_pathoption toconfig/alt-redirect.php, allowing users to specify the base directory for redirect and query string files.Repository refactoring:
FileRepositoryto use the newroot_pathconfiguration for all file operations, replacing hardcoded paths throughout methods such asfind,save,delete, andgetRegex. [1] [2] [3] [4] [5]Service provider updates:
ServiceProviderto use the configurableroot_pathwhen installing default query strings and marker files.Test improvements:
root_pathconfiguration and added a new test to verify that custom root paths are supported and function correctly. [1] [2] [3]