Summary: | Add ability to configure mojolicious applications | ||
---|---|---|---|
Product: | Koha | Reporter: | Julian Maurice <julian.maurice> |
Component: | Architecture, internals, and plumbing | Assignee: | Julian Maurice <julian.maurice> |
Status: | Patch doesn't apply --- | QA Contact: | Testopia <testopia> |
Severity: | enhancement | ||
Priority: | P5 - low | CC: | david, dcook, jonathan.druart, pedro.amorim |
Version: | Main | ||
Hardware: | All | ||
OS: | All | ||
GIT URL: | Change sponsored?: | --- | |
Patch complexity: | --- | Documentation contact: | |
Documentation submission: | Text to go in the release notes: | ||
Version(s) released in: | Circulation function: | ||
Bug Depends on: | 20582 | ||
Bug Blocks: | |||
Attachments: |
Bug 26625: Add a mojolicious section in $KOHA_CONF
Bug 26625: (alternative) Use Config plugin in Mojolicious apps |
Description
Julian Maurice
2020-10-07 08:27:32 UTC
Created attachment 111323 [details] [review] Bug 26625: Add a mojolicious section in $KOHA_CONF This allows to configure hypnotoad (listen address, number of workers, ...) https://metacpan.org/pod/Mojo::Server::Hypnotoad#SETTINGS Test plan: 1. Do not apply the patch yet 2. Run `hypnotoad bin/opac` and see that it listens on "http://*:8080" (its default value) 3. Run `hypnotoad -s bin/opac` to stop it 4. Repeat steps 2-3 for intranet 5. Apply the patch 6. Copy the <mojolicious> section from etc/koha-conf.xml to your $KOHA_CONF 7. Change the value of //mojolicious/opac/config/hypnotoad/listen in your $KOHA_CONF to "http://*:8181" 8. Run `hypnotoad bin/opac` and see that it now listens on port 8181 9. Run `hypnotoad -s bin/opac` to stop it 10. Repeat steps 7-9 for intranet As an alternative, we could use the mojolicious Config plugin, but that would require having a separate configuration file for mojo. It might be a good idea, but really I don't know. It's a thing to consider while reviewing this patch. Created attachment 111365 [details] [review] Bug 26625: (alternative) Use Config plugin in Mojolicious apps This allows to have separate config files for each mojolicious app. They can also both use the same config file. The config file is Perl code, so the configuration can be dynamic See https://docs.mojolicious.org/Mojolicious/Plugin/Config (In reply to Julian Maurice from comment #3) > As an alternative, we could use the mojolicious Config plugin, but that > would require having a separate configuration file for mojo. It might be a > good idea, but really I don't know. It's a thing to consider while reviewing > this patch. I am fond of Config plugins ( like Catalyst::Plugin::ConfigLoader ), although with Catalyst I had the issue where I wanted to access the config in the Catalyst config from outside Catalyst for arbitrary non-web config items. Not sure how that works with Mojolicious, but with Catalyst I had to use Config::JFDI. But if there is something that is strictly relating to Mojolicious, I think having a separate config file sounds like a good idea. Considering that koha-conf.xml is actually a corruption of a YAZ configuration file, I think we should really be looking at alternatives to putting more things in koha-conf.xml... (In reply to David Cook from comment #5) > I am fond of Config plugins ( like Catalyst::Plugin::ConfigLoader ), > although with Catalyst I had the issue where I wanted to access the config > in the Catalyst config from outside Catalyst for arbitrary non-web config > items. Not sure how that works with Mojolicious, but with Catalyst I had to > use Config::JFDI. The eval command can be used for that: `bin/intranet eval -v 'use JSON; to_json(app->config)`. Not the most efficient way to read a config file, but at least it doesn't depend on config file format. I had a go at testing, as this has been sitting in the needs sign off queue for a while. FYI: I don't know what a "mojolicious app" is, or what the use case is, and how to use it 8-) (so I am probably not the right person to test it!). Some notes from testing: 1. Steps 2 and 3: I get these messages: kohadev-koha@kohadevbox:koha(master)$ hypnotoad bin/opac Can't create listen socket: Address already in use at /usr/share/perl5/Mojo/IOLoop.pm line 124. kohadev-koha@kohadevbox:koha(master)$ hypnotoad bin/intranet Can't create listen socket: Address already in use at /usr/share/perl5/Mojo/IOLoop.pm line 124. 2. As expected (since it's been here a while), the first patch doesn't apply - the alternative patch still applies though: kohadev-koha@kohadevbox:koha(bz26625)$ git bz apply 26625 Bug 26625 - Add ability to configure mojolicious applications 111323 - Bug 26625: Add a mojolicious section in $KOHA_CONF 111365 - Bug 26625: (alternative) Use Config plugin in Mojolicious apps Apply? [(y)es, (n)o, (i)nteractive] i Applying: Bug 26625: Add a mojolicious section in $KOHA_CONF Using index info to reconstruct a base tree... M etc/koha-conf.xml Falling back to patching base and 3-way merge... Auto-merging etc/koha-conf.xml CONFLICT (content): Merge conflict in etc/koha-conf.xml error: Failed to merge in the changes. Patch failed at 0001 Bug 26625: Add a mojolicious section in $KOHA_CONF |