https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=37431

            Bug ID: 37431
           Summary: A way to access the Plugin itself from a Mojolicious
                    Controller
 Change sponsored?: ---
           Product: Koha
           Version: unspecified
          Hardware: All
                OS: All
            Status: NEW
          Severity: enhancement
          Priority: P5 - low
         Component: Plugin architecture
          Assignee: [email protected]
          Reporter: [email protected]
        QA Contact: [email protected]

While a Koha::Plugin has handy builtins for configuration in the form of
store_data() and retrieve_data(), these are not easily accessible from the
Mojolicious controllers that we configure in `api_routes()`. My use case
specifically is allowing the plugin users to configure an API key in the Plugin
(using `configure()`), and then using that API key in the Mojolicious
controller.

The way to accomplish this currently is manually instantiating the plugin in
the controller and using that for the lookup as so:
`Koha::Plugin::MyOrg::MyPlugin->new->retrieve_data(...)`

This does not feel like a good solution since it's hard to say how Koha will
react to us instantiating a Plugin multiple times without reading the code. It
seems harmless for now, but there's no guarantee that it won't break something
in the future.

Ideally I'd see the alternative as something akin to
https://metacpan.org/pod/Mojolicious::Controller#app method which currently
that gives us a Koha::REST::V1 instance. I'd like to have a `plugin()`
available in there as well, so that I could do a `$c->plugin->retrieve_data()`
in my routes.

Not sure how an implementation of that would look; perhaps there are better
alternatives?

-- 
You are receiving this mail because:
You are the assignee for the bug.
You are watching all bug changes.
_______________________________________________
Koha-bugs mailing list
[email protected]
https://lists.koha-community.org/cgi-bin/mailman/listinfo/koha-bugs
website : http://www.koha-community.org/
git : http://git.koha-community.org/
bugs : http://bugs.koha-community.org/

Reply via email to