Skip to content

Commit

Permalink
feat: set constants.apisix_lua_home for used by plugins (apache#7893)
Browse files Browse the repository at this point in the history
  • Loading branch information
kingluo authored Sep 9, 2022
1 parent bd93337 commit 047f629
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 0 deletions.
5 changes: 5 additions & 0 deletions apisix/cli/ngx_tpl.lua
Original file line number Diff line number Diff line change
Expand Up @@ -432,6 +432,11 @@ http {
dns_resolver = dns_resolver,
}
apisix.http_init(args)
-- set apisix_lua_home into constans module
-- it may be used by plugins to determine the work path of apisix
local constants = require("apisix.constants")
constants.apisix_lua_home = "{*apisix_lua_home*}"
}
init_worker_by_lua_block {
Expand Down
6 changes: 6 additions & 0 deletions t/APISIX.pm
Original file line number Diff line number Diff line change
Expand Up @@ -490,6 +490,12 @@ _EOC_
dns_resolver = $dns_addrs_tbl_str,
}
apisix.http_init(args)
-- set apisix_lua_home into constans module
-- it may be used by plugins to determine the work path of apisix
local constants = require("apisix.constants")
constants.apisix_lua_home = "$apisix_home"
$extra_init_by_lua
_EOC_

Expand Down

0 comments on commit 047f629

Please sign in to comment.