This is an automated email from the ASF dual-hosted git repository. wenming pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/incubator-apisix.git
The following commit(s) were added to refs/heads/master by this push: new c76e7e3 feature: remove `lua` dir. (#1351) c76e7e3 is described below commit c76e7e3623f871987f006848c6c6abcb59550bdb Author: Wen Ming <moonbingb...@gmail.com> AuthorDate: Tue Mar 31 23:23:29 2020 +0800 feature: remove `lua` dir. (#1351) --- Contributing.md | 18 +++---- Makefile | 55 ++++++++++------------ {lua/apisix => apisix}/admin/consumers.lua | 0 {lua/apisix => apisix}/admin/global_rules.lua | 0 {lua/apisix => apisix}/admin/init.lua | 0 {lua/apisix => apisix}/admin/plugins.lua | 0 {lua/apisix => apisix}/admin/proto.lua | 0 {lua/apisix => apisix}/admin/routes.lua | 0 {lua/apisix => apisix}/admin/schema.lua | 0 {lua/apisix => apisix}/admin/services.lua | 0 {lua/apisix => apisix}/admin/ssl.lua | 0 {lua/apisix => apisix}/admin/stream_routes.lua | 0 {lua/apisix => apisix}/admin/upstreams.lua | 0 {lua/apisix => apisix}/balancer.lua | 0 {lua/apisix => apisix}/consumer.lua | 0 {lua/apisix => apisix}/core.lua | 0 {lua/apisix => apisix}/core/config_etcd.lua | 0 {lua/apisix => apisix}/core/config_local.lua | 0 {lua/apisix => apisix}/core/config_yaml.lua | 0 {lua/apisix => apisix}/core/ctx.lua | 0 {lua/apisix => apisix}/core/etcd.lua | 0 {lua/apisix => apisix}/core/http.lua | 0 {lua/apisix => apisix}/core/id.lua | 0 {lua/apisix => apisix}/core/json.lua | 0 {lua/apisix => apisix}/core/log.lua | 0 {lua/apisix => apisix}/core/lrucache.lua | 0 {lua/apisix => apisix}/core/profile.lua | 0 {lua/apisix => apisix}/core/request.lua | 0 {lua/apisix => apisix}/core/response.lua | 0 {lua/apisix => apisix}/core/schema.lua | 0 {lua/apisix => apisix}/core/table.lua | 0 {lua/apisix => apisix}/core/timer.lua | 0 {lua/apisix => apisix}/core/utils.lua | 0 {lua/apisix => apisix}/core/version.lua | 0 {lua/apisix => apisix}/debug.lua | 0 .../http/router/radixtree_host_uri.lua | 0 .../http/router/radixtree_sni.lua | 0 .../http/router/radixtree_uri.lua | 0 {lua/apisix => apisix}/http/service.lua | 0 lua/apisix.lua => apisix/init.lua | 0 {lua/apisix => apisix}/plugin.lua | 0 {lua/apisix => apisix}/plugins/basic-auth.lua | 0 {lua/apisix => apisix}/plugins/cors.lua | 0 {lua/apisix => apisix}/plugins/example-plugin.lua | 0 {lua/apisix => apisix}/plugins/fault-injection.lua | 0 {lua/apisix => apisix}/plugins/grpc-transcode.lua | 0 .../plugins/grpc-transcode/proto.lua | 0 .../plugins/grpc-transcode/request.lua | 0 .../plugins/grpc-transcode/response.lua | 0 .../plugins/grpc-transcode/util.lua | 0 {lua/apisix => apisix}/plugins/heartbeat.lua | 0 {lua/apisix => apisix}/plugins/ip-restriction.lua | 0 {lua/apisix => apisix}/plugins/jwt-auth.lua | 0 {lua/apisix => apisix}/plugins/kafka-logger.lua | 0 {lua/apisix => apisix}/plugins/key-auth.lua | 0 {lua/apisix => apisix}/plugins/limit-conn.lua | 0 {lua/apisix => apisix}/plugins/limit-count.lua | 0 .../plugins/limit-count/limit-count-redis.lua | 0 {lua/apisix => apisix}/plugins/limit-req.lua | 0 {lua/apisix => apisix}/plugins/node-status.lua | 0 {lua/apisix => apisix}/plugins/openid-connect.lua | 0 {lua/apisix => apisix}/plugins/prometheus.lua | 0 .../plugins/prometheus/exporter.lua | 0 {lua/apisix => apisix}/plugins/proxy-cache.lua | 0 {lua/apisix => apisix}/plugins/proxy-mirror.lua | 0 {lua/apisix => apisix}/plugins/proxy-rewrite.lua | 0 {lua/apisix => apisix}/plugins/redirect.lua | 0 .../apisix => apisix}/plugins/response-rewrite.lua | 0 .../plugins/serverless-post-function.lua | 0 .../plugins/serverless-pre-function.lua | 0 {lua/apisix => apisix}/plugins/serverless.lua | 0 {lua/apisix => apisix}/plugins/tcp-logger.lua | 0 {lua/apisix => apisix}/plugins/udp-logger.lua | 0 {lua/apisix => apisix}/plugins/wolf-rbac.lua | 0 {lua/apisix => apisix}/plugins/zipkin.lua | 0 {lua/apisix => apisix}/plugins/zipkin/codec.lua | 0 .../plugins/zipkin/random_sampler.lua | 0 {lua/apisix => apisix}/plugins/zipkin/reporter.lua | 0 {lua/apisix => apisix}/router.lua | 0 {lua/apisix => apisix}/schema_def.lua | 0 .../stream/plugins/mqtt-proxy.lua | 0 {lua/apisix => apisix}/stream/router/ip_port.lua | 0 {lua/apisix => apisix}/utils/batch-processor.lua | 0 {lua/apisix => apisix}/utils/log-util.lua | 0 bin/apisix | 18 +++---- doc/architecture-design-cn.md | 2 +- doc/architecture-design.md | 2 +- doc/plugin-develop-cn.md | 4 +- doc/plugin-develop.md | 4 +- t/APISIX.pm | 4 +- t/apisix.luacov | 28 +++++------ utils/check-lua-code-style.sh | 20 ++++---- 92 files changed, 73 insertions(+), 82 deletions(-) diff --git a/Contributing.md b/Contributing.md index d681437..cca0bfe 100644 --- a/Contributing.md +++ b/Contributing.md @@ -103,15 +103,15 @@ Once we've discussed your changes and you've got your code ready, make sure that $ make lint luacheck -q lua Total: 0 warnings / 0 errors in 74 files - ./utils/lj-releng lua/*.lua \ - lua/apisix/*.lua \ - lua/apisix/admin/*.lua \ - lua/apisix/core/*.lua \ - lua/apisix/http/*.lua \ - lua/apisix/http/router/*.lua \ - lua/apisix/plugins/*.lua \ - lua/apisix/plugins/grpc-transcode/*.lua \ - lua/apisix/plugins/limit-count/*.lua > \ + ./utils/lj-releng \ + apisix/*.lua \ + apisix/admin/*.lua \ + apisix/core/*.lua \ + apisix/http/*.lua \ + apisix/http/router/*.lua \ + apisix/plugins/*.lua \ + apisix/plugins/grpc-transcode/*.lua \ + apisix/plugins/limit-count/*.lua > \ /tmp/check.log 2>&1 || (cat /tmp/check.log && exit 1) ``` * test case style diff --git a/Makefile b/Makefile index a695765..7fe019d 100644 --- a/Makefile +++ b/Makefile @@ -117,47 +117,44 @@ install: $(INSTALL) conf/config.yaml /usr/local/apisix/conf/config.yaml $(INSTALL) conf/cert/apisix.* /usr/local/apisix/conf/cert/ - $(INSTALL) -d $(INST_LUADIR)/apisix/lua - $(INSTALL) lua/*.lua $(INST_LUADIR)/apisix/lua/ + $(INSTALL) -d $(INST_LUADIR)/apisix + $(INSTALL) apisix/*.lua $(INST_LUADIR)/apisix/ - $(INSTALL) -d $(INST_LUADIR)/apisix/lua/apisix - $(INSTALL) lua/apisix/*.lua $(INST_LUADIR)/apisix/lua/apisix/ + $(INSTALL) -d $(INST_LUADIR)/apisix/admin + $(INSTALL) apisix/admin/*.lua $(INST_LUADIR)/apisix/admin/ - $(INSTALL) -d $(INST_LUADIR)/apisix/lua/apisix/admin - $(INSTALL) lua/apisix/admin/*.lua $(INST_LUADIR)/apisix/lua/apisix/admin/ + $(INSTALL) -d $(INST_LUADIR)/apisix/core + $(INSTALL) apisix/core/*.lua $(INST_LUADIR)/apisix/core/ - $(INSTALL) -d $(INST_LUADIR)/apisix/lua/apisix/core - $(INSTALL) lua/apisix/core/*.lua $(INST_LUADIR)/apisix/lua/apisix/core/ + $(INSTALL) -d $(INST_LUADIR)/apisix/http + $(INSTALL) apisix/http/*.lua $(INST_LUADIR)/apisix/http/ - $(INSTALL) -d $(INST_LUADIR)/apisix/lua/apisix/http - $(INSTALL) lua/apisix/http/*.lua $(INST_LUADIR)/apisix/lua/apisix/http/ + $(INSTALL) -d $(INST_LUADIR)/apisix/http/router + $(INSTALL) apisix/http/router/*.lua $(INST_LUADIR)/apisix/http/router/ - $(INSTALL) -d $(INST_LUADIR)/apisix/lua/apisix/http/router - $(INSTALL) lua/apisix/http/router/*.lua $(INST_LUADIR)/apisix/lua/apisix/http/router/ + $(INSTALL) -d $(INST_LUADIR)/apisix/plugins + $(INSTALL) apisix/plugins/*.lua $(INST_LUADIR)/apisix/plugins/ - $(INSTALL) -d $(INST_LUADIR)/apisix/lua/apisix/plugins - $(INSTALL) lua/apisix/plugins/*.lua $(INST_LUADIR)/apisix/lua/apisix/plugins/ + $(INSTALL) -d $(INST_LUADIR)/apisix/plugins/grpc-transcode + $(INSTALL) apisix/plugins/grpc-transcode/*.lua $(INST_LUADIR)/apisix/plugins/grpc-transcode/ - $(INSTALL) -d $(INST_LUADIR)/apisix/lua/apisix/plugins/grpc-transcode - $(INSTALL) lua/apisix/plugins/grpc-transcode/*.lua $(INST_LUADIR)/apisix/lua/apisix/plugins/grpc-transcode/ + $(INSTALL) -d $(INST_LUADIR)/apisix/plugins/limit-count + $(INSTALL) apisix/plugins/limit-count/*.lua $(INST_LUADIR)/apisix/plugins/limit-count/ - $(INSTALL) -d $(INST_LUADIR)/apisix/lua/apisix/plugins/limit-count - $(INSTALL) lua/apisix/plugins/limit-count/*.lua $(INST_LUADIR)/apisix/lua/apisix/plugins/limit-count/ + $(INSTALL) -d $(INST_LUADIR)/apisix/plugins/prometheus + $(INSTALL) apisix/plugins/prometheus/*.lua $(INST_LUADIR)/apisix/plugins/prometheus/ - $(INSTALL) -d $(INST_LUADIR)/apisix/lua/apisix/plugins/prometheus - $(INSTALL) lua/apisix/plugins/prometheus/*.lua $(INST_LUADIR)/apisix/lua/apisix/plugins/prometheus/ + $(INSTALL) -d $(INST_LUADIR)/apisix/plugins/zipkin + $(INSTALL) apisix/plugins/zipkin/*.lua $(INST_LUADIR)/apisix/plugins/zipkin/ - $(INSTALL) -d $(INST_LUADIR)/apisix/lua/apisix/plugins/zipkin - $(INSTALL) lua/apisix/plugins/zipkin/*.lua $(INST_LUADIR)/apisix/lua/apisix/plugins/zipkin/ + $(INSTALL) -d $(INST_LUADIR)/apisix/stream/plugins + $(INSTALL) apisix/stream/plugins/*.lua $(INST_LUADIR)/apisix/stream/plugins/ - $(INSTALL) -d $(INST_LUADIR)/apisix/lua/apisix/stream/plugins - $(INSTALL) lua/apisix/stream/plugins/*.lua $(INST_LUADIR)/apisix/lua/apisix/stream/plugins/ + $(INSTALL) -d $(INST_LUADIR)/apisix/stream/router + $(INSTALL) apisix/stream/router/*.lua $(INST_LUADIR)/apisix/stream/router/ - $(INSTALL) -d $(INST_LUADIR)/apisix/lua/apisix/stream/router - $(INSTALL) lua/apisix/stream/router/*.lua $(INST_LUADIR)/apisix/lua/apisix/stream/router/ - - $(INSTALL) -d $(INST_LUADIR)/apisix/lua/apisix/utils - $(INSTALL) lua/apisix/utils/*.lua $(INST_LUADIR)/apisix/lua/apisix/utils/ + $(INSTALL) -d $(INST_LUADIR)/apisix/utils + $(INSTALL) apisix/utils/*.lua $(INST_LUADIR)/apisix/utils/ $(INSTALL) README.md $(INST_CONFDIR)/README.md $(INSTALL) bin/apisix $(INST_BINDIR)/apisix diff --git a/lua/apisix/admin/consumers.lua b/apisix/admin/consumers.lua similarity index 100% rename from lua/apisix/admin/consumers.lua rename to apisix/admin/consumers.lua diff --git a/lua/apisix/admin/global_rules.lua b/apisix/admin/global_rules.lua similarity index 100% rename from lua/apisix/admin/global_rules.lua rename to apisix/admin/global_rules.lua diff --git a/lua/apisix/admin/init.lua b/apisix/admin/init.lua similarity index 100% rename from lua/apisix/admin/init.lua rename to apisix/admin/init.lua diff --git a/lua/apisix/admin/plugins.lua b/apisix/admin/plugins.lua similarity index 100% rename from lua/apisix/admin/plugins.lua rename to apisix/admin/plugins.lua diff --git a/lua/apisix/admin/proto.lua b/apisix/admin/proto.lua similarity index 100% rename from lua/apisix/admin/proto.lua rename to apisix/admin/proto.lua diff --git a/lua/apisix/admin/routes.lua b/apisix/admin/routes.lua similarity index 100% rename from lua/apisix/admin/routes.lua rename to apisix/admin/routes.lua diff --git a/lua/apisix/admin/schema.lua b/apisix/admin/schema.lua similarity index 100% rename from lua/apisix/admin/schema.lua rename to apisix/admin/schema.lua diff --git a/lua/apisix/admin/services.lua b/apisix/admin/services.lua similarity index 100% rename from lua/apisix/admin/services.lua rename to apisix/admin/services.lua diff --git a/lua/apisix/admin/ssl.lua b/apisix/admin/ssl.lua similarity index 100% rename from lua/apisix/admin/ssl.lua rename to apisix/admin/ssl.lua diff --git a/lua/apisix/admin/stream_routes.lua b/apisix/admin/stream_routes.lua similarity index 100% rename from lua/apisix/admin/stream_routes.lua rename to apisix/admin/stream_routes.lua diff --git a/lua/apisix/admin/upstreams.lua b/apisix/admin/upstreams.lua similarity index 100% rename from lua/apisix/admin/upstreams.lua rename to apisix/admin/upstreams.lua diff --git a/lua/apisix/balancer.lua b/apisix/balancer.lua similarity index 100% rename from lua/apisix/balancer.lua rename to apisix/balancer.lua diff --git a/lua/apisix/consumer.lua b/apisix/consumer.lua similarity index 100% rename from lua/apisix/consumer.lua rename to apisix/consumer.lua diff --git a/lua/apisix/core.lua b/apisix/core.lua similarity index 100% rename from lua/apisix/core.lua rename to apisix/core.lua diff --git a/lua/apisix/core/config_etcd.lua b/apisix/core/config_etcd.lua similarity index 100% rename from lua/apisix/core/config_etcd.lua rename to apisix/core/config_etcd.lua diff --git a/lua/apisix/core/config_local.lua b/apisix/core/config_local.lua similarity index 100% rename from lua/apisix/core/config_local.lua rename to apisix/core/config_local.lua diff --git a/lua/apisix/core/config_yaml.lua b/apisix/core/config_yaml.lua similarity index 100% rename from lua/apisix/core/config_yaml.lua rename to apisix/core/config_yaml.lua diff --git a/lua/apisix/core/ctx.lua b/apisix/core/ctx.lua similarity index 100% rename from lua/apisix/core/ctx.lua rename to apisix/core/ctx.lua diff --git a/lua/apisix/core/etcd.lua b/apisix/core/etcd.lua similarity index 100% rename from lua/apisix/core/etcd.lua rename to apisix/core/etcd.lua diff --git a/lua/apisix/core/http.lua b/apisix/core/http.lua similarity index 100% rename from lua/apisix/core/http.lua rename to apisix/core/http.lua diff --git a/lua/apisix/core/id.lua b/apisix/core/id.lua similarity index 100% rename from lua/apisix/core/id.lua rename to apisix/core/id.lua diff --git a/lua/apisix/core/json.lua b/apisix/core/json.lua similarity index 100% rename from lua/apisix/core/json.lua rename to apisix/core/json.lua diff --git a/lua/apisix/core/log.lua b/apisix/core/log.lua similarity index 100% rename from lua/apisix/core/log.lua rename to apisix/core/log.lua diff --git a/lua/apisix/core/lrucache.lua b/apisix/core/lrucache.lua similarity index 100% rename from lua/apisix/core/lrucache.lua rename to apisix/core/lrucache.lua diff --git a/lua/apisix/core/profile.lua b/apisix/core/profile.lua similarity index 100% rename from lua/apisix/core/profile.lua rename to apisix/core/profile.lua diff --git a/lua/apisix/core/request.lua b/apisix/core/request.lua similarity index 100% rename from lua/apisix/core/request.lua rename to apisix/core/request.lua diff --git a/lua/apisix/core/response.lua b/apisix/core/response.lua similarity index 100% rename from lua/apisix/core/response.lua rename to apisix/core/response.lua diff --git a/lua/apisix/core/schema.lua b/apisix/core/schema.lua similarity index 100% rename from lua/apisix/core/schema.lua rename to apisix/core/schema.lua diff --git a/lua/apisix/core/table.lua b/apisix/core/table.lua similarity index 100% rename from lua/apisix/core/table.lua rename to apisix/core/table.lua diff --git a/lua/apisix/core/timer.lua b/apisix/core/timer.lua similarity index 100% rename from lua/apisix/core/timer.lua rename to apisix/core/timer.lua diff --git a/lua/apisix/core/utils.lua b/apisix/core/utils.lua similarity index 100% rename from lua/apisix/core/utils.lua rename to apisix/core/utils.lua diff --git a/lua/apisix/core/version.lua b/apisix/core/version.lua similarity index 100% rename from lua/apisix/core/version.lua rename to apisix/core/version.lua diff --git a/lua/apisix/debug.lua b/apisix/debug.lua similarity index 100% rename from lua/apisix/debug.lua rename to apisix/debug.lua diff --git a/lua/apisix/http/router/radixtree_host_uri.lua b/apisix/http/router/radixtree_host_uri.lua similarity index 100% rename from lua/apisix/http/router/radixtree_host_uri.lua rename to apisix/http/router/radixtree_host_uri.lua diff --git a/lua/apisix/http/router/radixtree_sni.lua b/apisix/http/router/radixtree_sni.lua similarity index 100% rename from lua/apisix/http/router/radixtree_sni.lua rename to apisix/http/router/radixtree_sni.lua diff --git a/lua/apisix/http/router/radixtree_uri.lua b/apisix/http/router/radixtree_uri.lua similarity index 100% rename from lua/apisix/http/router/radixtree_uri.lua rename to apisix/http/router/radixtree_uri.lua diff --git a/lua/apisix/http/service.lua b/apisix/http/service.lua similarity index 100% rename from lua/apisix/http/service.lua rename to apisix/http/service.lua diff --git a/lua/apisix.lua b/apisix/init.lua similarity index 100% rename from lua/apisix.lua rename to apisix/init.lua diff --git a/lua/apisix/plugin.lua b/apisix/plugin.lua similarity index 100% rename from lua/apisix/plugin.lua rename to apisix/plugin.lua diff --git a/lua/apisix/plugins/basic-auth.lua b/apisix/plugins/basic-auth.lua similarity index 100% rename from lua/apisix/plugins/basic-auth.lua rename to apisix/plugins/basic-auth.lua diff --git a/lua/apisix/plugins/cors.lua b/apisix/plugins/cors.lua similarity index 100% rename from lua/apisix/plugins/cors.lua rename to apisix/plugins/cors.lua diff --git a/lua/apisix/plugins/example-plugin.lua b/apisix/plugins/example-plugin.lua similarity index 100% rename from lua/apisix/plugins/example-plugin.lua rename to apisix/plugins/example-plugin.lua diff --git a/lua/apisix/plugins/fault-injection.lua b/apisix/plugins/fault-injection.lua similarity index 100% rename from lua/apisix/plugins/fault-injection.lua rename to apisix/plugins/fault-injection.lua diff --git a/lua/apisix/plugins/grpc-transcode.lua b/apisix/plugins/grpc-transcode.lua similarity index 100% rename from lua/apisix/plugins/grpc-transcode.lua rename to apisix/plugins/grpc-transcode.lua diff --git a/lua/apisix/plugins/grpc-transcode/proto.lua b/apisix/plugins/grpc-transcode/proto.lua similarity index 100% rename from lua/apisix/plugins/grpc-transcode/proto.lua rename to apisix/plugins/grpc-transcode/proto.lua diff --git a/lua/apisix/plugins/grpc-transcode/request.lua b/apisix/plugins/grpc-transcode/request.lua similarity index 100% rename from lua/apisix/plugins/grpc-transcode/request.lua rename to apisix/plugins/grpc-transcode/request.lua diff --git a/lua/apisix/plugins/grpc-transcode/response.lua b/apisix/plugins/grpc-transcode/response.lua similarity index 100% rename from lua/apisix/plugins/grpc-transcode/response.lua rename to apisix/plugins/grpc-transcode/response.lua diff --git a/lua/apisix/plugins/grpc-transcode/util.lua b/apisix/plugins/grpc-transcode/util.lua similarity index 100% rename from lua/apisix/plugins/grpc-transcode/util.lua rename to apisix/plugins/grpc-transcode/util.lua diff --git a/lua/apisix/plugins/heartbeat.lua b/apisix/plugins/heartbeat.lua similarity index 100% rename from lua/apisix/plugins/heartbeat.lua rename to apisix/plugins/heartbeat.lua diff --git a/lua/apisix/plugins/ip-restriction.lua b/apisix/plugins/ip-restriction.lua similarity index 100% rename from lua/apisix/plugins/ip-restriction.lua rename to apisix/plugins/ip-restriction.lua diff --git a/lua/apisix/plugins/jwt-auth.lua b/apisix/plugins/jwt-auth.lua similarity index 100% rename from lua/apisix/plugins/jwt-auth.lua rename to apisix/plugins/jwt-auth.lua diff --git a/lua/apisix/plugins/kafka-logger.lua b/apisix/plugins/kafka-logger.lua similarity index 100% rename from lua/apisix/plugins/kafka-logger.lua rename to apisix/plugins/kafka-logger.lua diff --git a/lua/apisix/plugins/key-auth.lua b/apisix/plugins/key-auth.lua similarity index 100% rename from lua/apisix/plugins/key-auth.lua rename to apisix/plugins/key-auth.lua diff --git a/lua/apisix/plugins/limit-conn.lua b/apisix/plugins/limit-conn.lua similarity index 100% rename from lua/apisix/plugins/limit-conn.lua rename to apisix/plugins/limit-conn.lua diff --git a/lua/apisix/plugins/limit-count.lua b/apisix/plugins/limit-count.lua similarity index 100% rename from lua/apisix/plugins/limit-count.lua rename to apisix/plugins/limit-count.lua diff --git a/lua/apisix/plugins/limit-count/limit-count-redis.lua b/apisix/plugins/limit-count/limit-count-redis.lua similarity index 100% rename from lua/apisix/plugins/limit-count/limit-count-redis.lua rename to apisix/plugins/limit-count/limit-count-redis.lua diff --git a/lua/apisix/plugins/limit-req.lua b/apisix/plugins/limit-req.lua similarity index 100% rename from lua/apisix/plugins/limit-req.lua rename to apisix/plugins/limit-req.lua diff --git a/lua/apisix/plugins/node-status.lua b/apisix/plugins/node-status.lua similarity index 100% rename from lua/apisix/plugins/node-status.lua rename to apisix/plugins/node-status.lua diff --git a/lua/apisix/plugins/openid-connect.lua b/apisix/plugins/openid-connect.lua similarity index 100% rename from lua/apisix/plugins/openid-connect.lua rename to apisix/plugins/openid-connect.lua diff --git a/lua/apisix/plugins/prometheus.lua b/apisix/plugins/prometheus.lua similarity index 100% rename from lua/apisix/plugins/prometheus.lua rename to apisix/plugins/prometheus.lua diff --git a/lua/apisix/plugins/prometheus/exporter.lua b/apisix/plugins/prometheus/exporter.lua similarity index 100% rename from lua/apisix/plugins/prometheus/exporter.lua rename to apisix/plugins/prometheus/exporter.lua diff --git a/lua/apisix/plugins/proxy-cache.lua b/apisix/plugins/proxy-cache.lua similarity index 100% rename from lua/apisix/plugins/proxy-cache.lua rename to apisix/plugins/proxy-cache.lua diff --git a/lua/apisix/plugins/proxy-mirror.lua b/apisix/plugins/proxy-mirror.lua similarity index 100% rename from lua/apisix/plugins/proxy-mirror.lua rename to apisix/plugins/proxy-mirror.lua diff --git a/lua/apisix/plugins/proxy-rewrite.lua b/apisix/plugins/proxy-rewrite.lua similarity index 100% rename from lua/apisix/plugins/proxy-rewrite.lua rename to apisix/plugins/proxy-rewrite.lua diff --git a/lua/apisix/plugins/redirect.lua b/apisix/plugins/redirect.lua similarity index 100% rename from lua/apisix/plugins/redirect.lua rename to apisix/plugins/redirect.lua diff --git a/lua/apisix/plugins/response-rewrite.lua b/apisix/plugins/response-rewrite.lua similarity index 100% rename from lua/apisix/plugins/response-rewrite.lua rename to apisix/plugins/response-rewrite.lua diff --git a/lua/apisix/plugins/serverless-post-function.lua b/apisix/plugins/serverless-post-function.lua similarity index 100% rename from lua/apisix/plugins/serverless-post-function.lua rename to apisix/plugins/serverless-post-function.lua diff --git a/lua/apisix/plugins/serverless-pre-function.lua b/apisix/plugins/serverless-pre-function.lua similarity index 100% rename from lua/apisix/plugins/serverless-pre-function.lua rename to apisix/plugins/serverless-pre-function.lua diff --git a/lua/apisix/plugins/serverless.lua b/apisix/plugins/serverless.lua similarity index 100% rename from lua/apisix/plugins/serverless.lua rename to apisix/plugins/serverless.lua diff --git a/lua/apisix/plugins/tcp-logger.lua b/apisix/plugins/tcp-logger.lua similarity index 100% rename from lua/apisix/plugins/tcp-logger.lua rename to apisix/plugins/tcp-logger.lua diff --git a/lua/apisix/plugins/udp-logger.lua b/apisix/plugins/udp-logger.lua similarity index 100% rename from lua/apisix/plugins/udp-logger.lua rename to apisix/plugins/udp-logger.lua diff --git a/lua/apisix/plugins/wolf-rbac.lua b/apisix/plugins/wolf-rbac.lua similarity index 100% rename from lua/apisix/plugins/wolf-rbac.lua rename to apisix/plugins/wolf-rbac.lua diff --git a/lua/apisix/plugins/zipkin.lua b/apisix/plugins/zipkin.lua similarity index 100% rename from lua/apisix/plugins/zipkin.lua rename to apisix/plugins/zipkin.lua diff --git a/lua/apisix/plugins/zipkin/codec.lua b/apisix/plugins/zipkin/codec.lua similarity index 100% rename from lua/apisix/plugins/zipkin/codec.lua rename to apisix/plugins/zipkin/codec.lua diff --git a/lua/apisix/plugins/zipkin/random_sampler.lua b/apisix/plugins/zipkin/random_sampler.lua similarity index 100% rename from lua/apisix/plugins/zipkin/random_sampler.lua rename to apisix/plugins/zipkin/random_sampler.lua diff --git a/lua/apisix/plugins/zipkin/reporter.lua b/apisix/plugins/zipkin/reporter.lua similarity index 100% rename from lua/apisix/plugins/zipkin/reporter.lua rename to apisix/plugins/zipkin/reporter.lua diff --git a/lua/apisix/router.lua b/apisix/router.lua similarity index 100% rename from lua/apisix/router.lua rename to apisix/router.lua diff --git a/lua/apisix/schema_def.lua b/apisix/schema_def.lua similarity index 100% rename from lua/apisix/schema_def.lua rename to apisix/schema_def.lua diff --git a/lua/apisix/stream/plugins/mqtt-proxy.lua b/apisix/stream/plugins/mqtt-proxy.lua similarity index 100% rename from lua/apisix/stream/plugins/mqtt-proxy.lua rename to apisix/stream/plugins/mqtt-proxy.lua diff --git a/lua/apisix/stream/router/ip_port.lua b/apisix/stream/router/ip_port.lua similarity index 100% rename from lua/apisix/stream/router/ip_port.lua rename to apisix/stream/router/ip_port.lua diff --git a/lua/apisix/utils/batch-processor.lua b/apisix/utils/batch-processor.lua similarity index 100% rename from lua/apisix/utils/batch-processor.lua rename to apisix/utils/batch-processor.lua diff --git a/lua/apisix/utils/log-util.lua b/apisix/utils/log-util.lua similarity index 100% rename from lua/apisix/utils/log-util.lua rename to apisix/utils/log-util.lua diff --git a/bin/apisix b/bin/apisix index 147e308..83712c4 100755 --- a/bin/apisix +++ b/bin/apisix @@ -39,9 +39,7 @@ local pkg_path_org = package.path local apisix_home = "/usr/local/apisix" local pkg_cpath = apisix_home .. "/deps/lib64/lua/5.1/?.so;" .. apisix_home .. "/deps/lib/lua/5.1/?.so;;" -local pkg_path = apisix_home .. "/deps/share/lua/5.1/apisix/lua/?.lua;" - .. "/usr/local/share/lua/5.1/apisix/lua/?.lua;" - .. apisix_home .. "/deps/share/lua/5.1/?.lua;;" +local pkg_path = apisix_home .. "/deps/share/lua/5.1/?.lua;;" -- only for developer, use current folder as working space local is_root_path = false @@ -58,7 +56,7 @@ if script_path:sub(1, 2) == './' then pkg_cpath = apisix_home .. "/deps/lib64/lua/5.1/?.so;" .. apisix_home .. "/deps/lib/lua/5.1/?.so;" - pkg_path = apisix_home .. "/lua/?.lua;" + pkg_path = apisix_home .. "/?/init.lua;" .. apisix_home .. "/deps/share/lua/5.1/?.lua;;" end -- print("apisix_home: ", apisix_home) @@ -113,10 +111,8 @@ env APISIX_PROFILE; {% if stream_proxy then %} stream { - lua_package_path "$prefix/deps/share/lua/5.1/?.lua;/usr/share/lua/5.1/apisix/lua/?.lua;]=] - .. [=[/usr/local/share/lua/5.1/apisix/lua/?.lua;]=] - .. [=[$prefix/deps/share/lua/5.1/apisix/lua/?.lua;]=] - .. [=[{*apisix_lua_home*}/lua/?.lua;;{*lua_path*};"; + lua_package_path "$prefix/deps/share/lua/5.1/?.lua;]=] + .. [=[{*apisix_lua_home*}/?.lua;{*apisix_lua_home*}/?/init.lua;;{*lua_path*};"; lua_package_cpath "$prefix/deps/lib64/lua/5.1/?.so;]=] .. [=[$prefix/deps/lib/lua/5.1/?.so;;]=] .. [=[{*lua_cpath*};"; @@ -168,10 +164,8 @@ stream { {% end %} http { - lua_package_path "$prefix/deps/share/lua/5.1/?.lua;/usr/share/lua/5.1/apisix/lua/?.lua;]=] - .. [=[/usr/local/share/lua/5.1/apisix/lua/?.lua;]=] - .. [=[$prefix/deps/share/lua/5.1/apisix/lua/?.lua;]=] - .. [=[{*apisix_lua_home*}/lua/?.lua;;{*lua_path*};"; + lua_package_path "$prefix/deps/share/lua/5.1/?.lua;]=] + .. [=[{*apisix_lua_home*}/?.lua;{*apisix_lua_home*}/?/init.lua;;{*lua_path*};"; lua_package_cpath "$prefix/deps/lib64/lua/5.1/?.so;]=] .. [=[$prefix/deps/lib/lua/5.1/?.so;;]=] .. [=[{*lua_cpath*};"; diff --git a/doc/architecture-design-cn.md b/doc/architecture-design-cn.md index b212b0f..27b4cca 100644 --- a/doc/architecture-design-cn.md +++ b/doc/architecture-design-cn.md @@ -192,7 +192,7 @@ curl http://127.0.0.1:9080/apisix/admin/routes/102 -H 'X-API-KEY: edd1c9f034335f 优先级更高。 一个插件在一次请求中只会执行一次,即使被同时绑定到多个不同对象中(比如 Route 或 Service)。 -插件运行先后顺序是根据插件自身的优先级来决定的,例如:[example-plugin](../lua/apisix/plugins/example-plugin.lua#L37)。 +插件运行先后顺序是根据插件自身的优先级来决定的,例如:[example-plugin](../apisix/plugins/example-plugin.lua#L37)。 插件配置作为 Route 或 Service 的一部分提交的,放到 `plugins` 下。它内部是使用插件 名字作为哈希的 key 来保存不同插件的配置项。 diff --git a/doc/architecture-design.md b/doc/architecture-design.md index 84de71a..9731a78 100644 --- a/doc/architecture-design.md +++ b/doc/architecture-design.md @@ -190,7 +190,7 @@ The configuration of the plugin can be directly bound to the specified Route, or A plugin will only be executed once in a single request, even if it is bound to multiple different objects (such as Route or Service). -The order in which plugins are run is determined by the priority of the plugin itself, for example: [example-plugin](../lua/apisix/plugins/example-plugin.lua#L37). +The order in which plugins are run is determined by the priority of the plugin itself, for example: [example-plugin](../apisix/plugins/example-plugin.lua#L37). The plugin configuration is submitted as part of Route or Service and placed under `plugins`. It internally uses the plugin name as the hash's key to hold configuration items for different plugins. diff --git a/doc/plugin-develop-cn.md b/doc/plugin-develop-cn.md index b1bc07e..9da4f6c 100644 --- a/doc/plugin-develop-cn.md +++ b/doc/plugin-develop-cn.md @@ -48,14 +48,14 @@ 插件本身提供了 init 方法。方便插件加载后做初始化动作。 -注:如果部分插件的功能实现,需要在 Nginx 初始化启动,则可能需要在 __lua/apisix.lua__ 文件的初始化方法 http_init 中添加逻辑,并且 +注:如果部分插件的功能实现,需要在 Nginx 初始化启动,则可能需要在 __apisix.lua__ 文件的初始化方法 http_init 中添加逻辑,并且 可能需要在 __bin/apisix__ 文件中,对 Nginx 配置文件生成的部分,添加一些你需要的处理。但是这样容易对全局产生影响,根据现有的 插件机制,我们不建议这样做,除非你已经对代码完全掌握。 ## 插件命名与配置 给插件取一个很棒的名字,确定插件的加载优先级,然后在 __conf/config.yaml__ 文件中添加上你的插件名。例如 key-auth 这个插件, -需要在代码里指定插件名称(名称是插件的唯一标识,不可重名),在 __lua/apisix/plugins/key-auth.lua__ 文件中可以看到: +需要在代码里指定插件名称(名称是插件的唯一标识,不可重名),在 __apisix/plugins/key-auth.lua__ 文件中可以看到: ```lua local plugin_name = "key-auth" diff --git a/doc/plugin-develop.md b/doc/plugin-develop.md index 5dbf2a9..8e18b0d 100644 --- a/doc/plugin-develop.md +++ b/doc/plugin-develop.md @@ -50,7 +50,7 @@ The plugin itself provides the init method. It is convenient for plugins to perf the plugin is loaded. Note : if the dependency of some plugin needs to be initialized when Nginx start, you may need to add logic to the initialization - method "http_init" in the file __lua/apisix.lua__, And you may need to add some processing on generated part of Nginx + method "http_init" in the file __apisix.lua__, And you may need to add some processing on generated part of Nginx configuration file in __bin/apisix__ file. but it is easy to have an impact on the overall situation according to the existing plugin mechanism, we do not recommend this unless you have a complete grasp of the code. @@ -58,7 +58,7 @@ Note : if the dependency of some plugin needs to be initialized when Nginx start determine the name and priority of the plugin, and add to conf/config.yaml. For example, for the key-auth plugin, you need to specify the plugin name in the code (the name is the unique identifier of the plugin and cannot be - duplicate), you can see the code in file "__lua/apisix/plugins/key-auth.lua__" : + duplicate), you can see the code in file "__apisix/plugins/key-auth.lua__" : ```lua local plugin_name = "key-auth" diff --git a/t/APISIX.pm b/t/APISIX.pm index 3347766..6b19152 100644 --- a/t/APISIX.pm +++ b/t/APISIX.pm @@ -107,7 +107,7 @@ _EOC_ my $stream_enable = $block->stream_enable; my $stream_config = $block->stream_config // <<_EOC_; - lua_package_path "$apisix_home/deps/share/lua/5.1/?.lua;$apisix_home/lua/?.lua;$apisix_home/t/?.lua;./?.lua;;"; + lua_package_path "$apisix_home/deps/share/lua/5.1/?.lua;$apisix_home/apisix/?.lua;$apisix_home/t/?.lua;./?.lua;./?/init.lua;;"; lua_package_cpath "$apisix_home/deps/lib/lua/5.1/?.so;$apisix_home/deps/lib64/lua/5.1/?.so;./?.so;;"; lua_socket_log_errors off; @@ -186,7 +186,7 @@ _EOC_ my $http_config = $block->http_config // ''; $http_config .= <<_EOC_; - lua_package_path "$apisix_home/deps/share/lua/5.1/?.lua;$apisix_home/lua/?.lua;$apisix_home/t/?.lua;./?.lua;;"; + lua_package_path "$apisix_home/deps/share/lua/5.1/?.lua;$apisix_home/apisix/?.lua;$apisix_home/t/?.lua;./?.lua;./?/init.lua;;"; lua_package_cpath "$apisix_home/deps/lib/lua/5.1/?.so;$apisix_home/deps/lib64/lua/5.1/?.so;./?.so;;"; lua_shared_dict plugin-limit-req 10m; diff --git a/t/apisix.luacov b/t/apisix.luacov index cdddc10..f9792d8 100644 --- a/t/apisix.luacov +++ b/t/apisix.luacov @@ -17,21 +17,21 @@ return { modules = { ["lua.*"] = "lua", - ["lua/apisix/*"] = "apisix", - ["lua/apisix/admin/*"] = "admin", - ["lua/apisix/core/*"] = "core", - ["lua/apisix/http/*"] = "http", - ["lua/apisix/http/router/*"] = "http/router", - ["lua/apisix/plugins/*"] = "plugins", - ["lua/apisix/plugins/grpc-transcode/*"] = "plugins/grpc-transcode", - ["lua/apisix/plugins/limit-count/*"] = "plugins/limit-count", - ["lua/apisix/plugins/prometheus/*"] = "plugins/prometheus", - ["lua/apisix/plugins/zipkin/*"] = "plugins/zipkin", - ["lua/apisix/utils/*"] = "utils", + ["apisix/*"] = "apisix", + ["apisix/admin/*"] = "admin", + ["apisix/core/*"] = "core", + ["apisix/http/*"] = "http", + ["apisix/http/router/*"] = "http/router", + ["apisix/plugins/*"] = "plugins", + ["apisix/plugins/grpc-transcode/*"] = "plugins/grpc-transcode", + ["apisix/plugins/limit-count/*"] = "plugins/limit-count", + ["apisix/plugins/prometheus/*"] = "plugins/prometheus", + ["apisix/plugins/zipkin/*"] = "plugins/zipkin", + ["apisix/utils/*"] = "utils", -- can not enable both at http and stream, will fix it later. - -- ["lua/apisix/stream/*"] = "stream", - -- ["lua/apisix/stream/plugins/*"] = "stream/plugins", - -- ["lua/apisix/stream/router/*"] = "stream/router", + -- ["apisix/stream/*"] = "stream", + -- ["apisix/stream/plugins/*"] = "stream/plugins", + -- ["apisix/stream/router/*"] = "stream/router", }, } diff --git a/utils/check-lua-code-style.sh b/utils/check-lua-code-style.sh index 34555f2..caee7b4 100755 --- a/utils/check-lua-code-style.sh +++ b/utils/check-lua-code-style.sh @@ -19,17 +19,17 @@ set -ex -luacheck -q lua +luacheck -q apisix -./utils/lj-releng lua/*.lua \ - lua/apisix/*.lua \ - lua/apisix/admin/*.lua \ - lua/apisix/core/*.lua \ - lua/apisix/http/*.lua \ - lua/apisix/http/router/*.lua \ - lua/apisix/plugins/*.lua \ - lua/apisix/plugins/grpc-transcode/*.lua \ - lua/apisix/plugins/limit-count/*.lua > \ +./utils/lj-releng \ + apisix/*.lua \ + apisix/admin/*.lua \ + apisix/core/*.lua \ + apisix/http/*.lua \ + apisix/http/router/*.lua \ + apisix/plugins/*.lua \ + apisix/plugins/grpc-transcode/*.lua \ + apisix/plugins/limit-count/*.lua > \ /tmp/check.log 2>&1 || (cat /tmp/check.log && exit 1) grep -E "ERROR.*.lua:" /tmp/check.log > /tmp/error.log | true