You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@apisix.apache.org by GitBox <gi...@apache.org> on 2021/09/09 09:16:27 UTC

[GitHub] [apisix] griffenliu opened a new issue #5027: request help: 配置文件扩展:允许用户在Nginx初始化阶段添加自定义代码

griffenliu opened a new issue #5027:
URL: https://github.com/apache/apisix/issues/5027


   ### Issue description
   
   我有一些需求,比如在apisix启动时添加一些自定义的初始化逻辑,在apisix管理API的基础上添加一些自定义的管理API等等。想要在Nginx初始化或者Worker初始化阶段做一些事情。是否可以考虑通过配置允许在这两个阶段添加一些自定义代码?
   比如:
   ```
   init_by_lua_block {
           require "resty.core"
           apisix = require("apisix")
   
           local dns_resolver = { {% for _, dns_addr in ipairs(dns_resolver or {}) do %} "{*dns_addr*}", {% end %} }
           local args = {
               dns_resolver = dns_resolver,
           }
           apisix.http_init(args)
           <通过配置添加自定义代码>
       }
       init_worker_by_lua_block {
           apisix.http_init_worker()
           <通过配置添加自定义代码>
       }
   
   ```
   
   配置中可以添加:
   ```
   nginx_config: 
     http_init_by_lua_configuration_snippet: |
   
     http_init_worker_by_lua_configuration_snippet: |
   ```
   
   ### Environment
   
   - apisix version (cmd: `apisix version`):
   - OS (cmd: `uname -a`):
   - OpenResty / Nginx version (cmd: `nginx -V` or `openresty -V`):
   - etcd version, if have (cmd: run `curl http://127.0.0.1:9090/v1/server_info` to get the info from server-info API):
   - apisix-dashboard version, if have:
   - luarocks version, if the issue is about installation (cmd: `luarocks --version`):
   


-- 
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: notifications-unsubscribe@apisix.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [apisix] tzssangglass closed issue #5027: request help: 配置文件扩展:是否可以考虑允许用户在Nginx初始化阶段添加自定义代码?

Posted by GitBox <gi...@apache.org>.
tzssangglass closed issue #5027:
URL: https://github.com/apache/apisix/issues/5027


   


-- 
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: notifications-unsubscribe@apisix.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org