hanqingwu commented on issue #10795:
URL: https://github.com/apache/apisix/issues/10795#issuecomment-1895618108

   I find root cause, If config.yaml not define plugins, then  it use  
alternate config-default.yaml, so  most plugins works , because them enable in 
config-default.yaml.  
   
   plugin.lua
   ```
   local function get_plugin_names(config)
       local http_plugin_names
       local stream_plugin_names
   
       if not config then
           -- called during starting or hot reload in admin
           local err
           local_conf, err = core.config.local_conf(true)    
           if not local_conf then
               -- the error is unrecoverable, so we need to raise it
               error("failed to load the configuration file: " .. err)
           end
   
           http_plugin_names = local_conf.plugins     
           stream_plugin_names = local_conf.stream_plugins
       else
           -- called during synchronizing plugin data
           http_plugin_names = {}
           stream_plugin_names = {}
           local plugins_conf = config.value        -- **here load config.yaml**
           -- plugins_conf can be nil when another instance writes into etcd 
key "/apisix/plugins/"
           if not plugins_conf then
               return true
           end
   
           for _, conf in ipairs(plugins_conf) do
               if conf.stream then
                   core.table.insert(stream_plugin_names, conf.name)
               else
                   core.table.insert(http_plugin_names, conf.name)
               end
           end
       end
   
       return false, http_plugin_names, stream_plugin_names
   end
   
   ```
   here load config-default.yaml
    **local_conf, err = core.config.local_conf(true)**                      
   
   So if  config.yaml enable plugins,  then  only enable these  plugins.
   


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