yuqiquan opened a new issue, #8138: URL: https://github.com/apache/apisix/issues/8138
### Description 我写了个测试插件 testetcd.lua `local ngx = ngx local core = require("apisix.core") local schema = { type = "object", properties = { key = { type = "string" }, } } local plugin_name = "testetcd" local _M = { version = 0.1, priority = 70, name = plugin_name, schema = schema, } function _M.check_schema(conf, schema_type) return core.schema.check(schema, conf) end function _M.init() end function _M.destroy() end function _M.rewrite(conf, ctx) end function _M.access(conf, ctx) local key = conf["key"] local etcd_cli, prefix, err = core.etcd.new() if not etcd_cli then core.log.warn("create etcd_cli failed, error --- > " , err) return end -- in etcd v2, get could implicitly turn into readdir -- while in v3, we need to do it explicitly local res, err = etcd_cli:readdir(key) if not res then core.log.warn("read etcd value failed, key --- > " , key) return end core.log.warn(core.json.encode(res.body)) end function _M.body_filter(conf, ctx) end function _M.delayed_body_filter(conf, ctx) end return _M ` 然后在路由中配置该插件 作用就是访问该路由 ,会在日志中打印etcd中 key为 /testetcd 的value值, 先用命令行 etcdctl put /testetcd hahahah赋值 然后访问 打印出如下信息 使用etcdctl get /testetcd 可以获取到 ### Environment - APISIX version (run `apisix version`): - Operating system (run `uname -a`): - OpenResty / Nginx version (run `openresty -V` or `nginx -V`): - etcd version, if relevant (run `curl http://127.0.0.1:9090/v1/server_info`): - APISIX Dashboard version, if relevant: - Plugin runner version, for issues related to plugin runners: - LuaRocks version, for installation issues (run `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-unsubscr...@apisix.apache.org.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org