Skip to content

Add support for loading library configuration from file in Bsz\Config… - #5

Merged
yanchun-bsz merged 3 commits into
developfrom
feature/db-libraries-file
Jun 26, 2026
Merged

Add support for loading library configuration from file in Bsz\Config…#5
yanchun-bsz merged 3 commits into
developfrom
feature/db-libraries-file

Conversation

@yanchun-bsz

Copy link
Copy Markdown

No description provided.

@yanchun-bsz
yanchun-bsz requested a review from sebsahli June 26, 2026 09:43

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good! However, I would consider taking advantage of the \VuFind\Config\Feature\SecretTrait, which already provides the getSecretFromConfig method for exactly our purpose (read secret from file, if available and fallback to config if there is no file). Thus, we can avoid code duplication and rely on code maintained by the community.

@yanchun-bsz yanchun-bsz Jun 26, 2026

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

SecretTrait works nicely in Koha, since it is an object instance. Factory::getLibrariesTable() is static, so getSecretFromConfig() cannot be called directly.

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh yes, you are right. Didn' think that through... In this case your way seems appropriate. However, in general, we want to try to avoid copying code from VuFind. In this case, an option would be to use a dedicated LibrariesTableFactory class instead of the static getLibrariesTable method. BOSS uses a lot of those static factory methods, while VuFind (and Laminas) prefers the factory approarch. So in the long run I also want to switch to factory classes. Then we can rework this part of code again, but for now it is fine :)

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks! Sounds good. I agree that a dedicated LibrariesTableFactory would be a cleaner solution. We can revisit this when we refactor the factories 🙂

@yanchun-bsz
yanchun-bsz requested a review from sebsahli June 26, 2026 11:51

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh yes, you are right. Didn' think that through... In this case your way seems appropriate. However, in general, we want to try to avoid copying code from VuFind. In this case, an option would be to use a dedicated LibrariesTableFactory class instead of the static getLibrariesTable method. BOSS uses a lot of those static factory methods, while VuFind (and Laminas) prefers the factory approarch. So in the long run I also want to switch to factory classes. Then we can rework this part of code again, but for now it is fine :)

@yanchun-bsz
yanchun-bsz merged commit 33c7f98 into develop Jun 26, 2026
1 of 7 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants