Skip to content

Commit

Permalink
fix(stream): limit block to stream context, preserve init_by_lua_block
Browse files Browse the repository at this point in the history
  • Loading branch information
motongxue committed Mar 15, 2024
1 parent b1087b2 commit 806f8ee
Showing 1 changed file with 19 additions and 4 deletions.
23 changes: 19 additions & 4 deletions apisix/cli/ngx_tpl.lua
Original file line number Diff line number Diff line change
Expand Up @@ -77,8 +77,6 @@ http {
.. [=[$prefix/deps/lib/lua/5.1/?.so;;]=]
.. [=[{*lua_cpath*};";
{% if enabled_stream_plugins["prometheus"] then %}
init_by_lua_block {
require "resty.core"
local process = require("ngx.process")
Expand All @@ -88,6 +86,8 @@ http {
end
}
{% if enabled_stream_plugins["prometheus"] then %}
init_worker_by_lua_block {
require("apisix.plugins.prometheus.exporter").http_init(true)
}
Expand Down Expand Up @@ -117,10 +117,9 @@ http {
{% else %}
init_by_lua_block {
}
init_worker_by_lua_block {
}
server {
listen {* prometheus_server_addr *};
access_log off;
Expand Down Expand Up @@ -571,6 +570,22 @@ http {
stub_status;
}
}
{% else %}
server {
listen {* prometheus_server_addr *};
access_log off;
location / {
return 404;
}
location = /apisix/nginx_status {
allow 127.0.0.0/24;
deny all;
stub_status;
}
}
{% end %}
{% if enable_admin then %}
Expand Down

0 comments on commit 806f8ee

Please sign in to comment.