hlg212 opened a new issue, #12921:
URL: https://github.com/apache/apisix/issues/12921

   ### Description
   
   I want to define a common configuration template for certain plugins (e.g., 
`limit-count`) that includes basic connection information (such as Redis host 
and port). When enabling the plugin on a route, I expect these basic properties 
to be automatically filled, while allowing the route to override specific 
properties (such as rate-limiting rules), rather than completely rewriting the 
entire plugin configuration.  
   
   I have tried using Plugin Config and Plugin Metadata, but their behavior 
does not meet expectations:  
   
   - **Plugin Metadata:** Requires internal plugin support and is not a general 
solution.  
   - **Conflict between Plugin Config and Route Configuration:** According to 
the official documentation, when the same plugin is configured across multiple 
objects (e.g., Route and Plugin Config), merging follows the priority order 
Consumer > Route > Plugin Config > Service. However, only the complete 
configuration of the highest-priority plugin instance is executed. This means 
the route configuration entirely replaces the Plugin Config configuration, 
rather than performing intelligent property-level merging and overriding.  
   
   **Reproduction Steps and Current Result:**  
   
   1. Create a Plugin Config containing `limit-count` connection information.  
   2. Create a route that references `plugin_config_id: test-plugin_config_id` 
and configures the `limit-count` plugin in the `plugins` field, specifying only 
different rate-limiting properties.  
   
   Example Configuration:  
   ```json
   {
     "time_window": 60,
     "redis_host": "local",
     "count": 5
   }
   ```
   
   Plugin Config Configuration:  
   ```json
   {
     "rejected_msg": "plugin configs !",
     "time_window": 60,
     "redis_host": "local",
     "count": 2
   }
   ```
   
   3. Test the route and observe that the plugin uses the route configuration 
but loses the `"rejected_msg"` information defined in the Plugin Config, 
resulting in a direct 503 error page (see screenshot: [image placeholder]).  
   
   <img width="1439" height="275" alt="Image" 
src="https://github.com/user-attachments/assets/0af4663c-8cdc-4b58-9f1c-3f1c4fd46367";
 />
   
   **Expected Behavior:**  
   I expect plugin configurations to support an "inheritance" or "default value 
filling" model. For example, with Redis plugins, the expected merging logic 
would be:  
   
   - Higher level (e.g., Plugin Config): Defines default/basic properties 
(host, port, password).  
   - Lower level (e.g., Route): Defines extended or overridden properties 
(database, timeout).  
   
   Final effective configuration: Properties specified at the lower level 
override those of the same name at the higher level, while unique properties 
from the higher level are automatically included. Example:  
   `{host, port, password} + {database, timeout} → {host, port, password, 
database, timeout}`.  
   
   **My Questions:**  
   1. In the current APISIX design, is there a way to achieve the 
"property-level merging" described above?  
   2. If not currently available, does the official team plan to support such 
functionality in future versions (e.g., enhancing the merging strategy for 
Plugin Config)?


-- 
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