nfrankel opened a new issue #6580:
URL: https://github.com/apache/apisix/issues/6580


   ### Issue description
   
   ## Current situation
   
   At the moment, you add a plugin in the request flow by referencing with its 
name and setting the configuration. The plugin is effectively a **singleton**. 
   
   This approach has some downsides:
   
   * You can use a plugin only once in the request flow. Users cannot add the 
same plugin multiple times with different configurations.
   * For maintainers, it means that they need to duplicate code and reference 
it with different names and priorities. For example, the 
[ext-plugin-pre-req](https://github.com/apache/apisix/blob/master/apisix/plugins/ext-plugin-pre-req.lua)
 and the 
[ext-plugin-post-req](https://github.com/apache/apisix/blob/master/apisix/plugins/ext-plugin-post-req.lua)
 do the same - run arbitrary Lua code.
   * Users cannot change the priority of a plugin, it's hard-coded (see #6504)
   * Plugin developers need to handle every possible configuration case (see 
#6197)
   
   ## Proposal
   
   In Object-Oriented speak, make `Plugin` a class and introduce 
`PluginInstance` "objects" (or something similarly named):
   
   * `Plugin` defines the code
   * `PluginInstance` references the `Plugin` and associates it with a priority 
and a configuration
   
   Decoupling the code from the configuration/priority would bring much more 
freedom for users.
   
   
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


Reply via email to