road to swarm - add openssl to autoconf, fix api_uri in LUA, fix file rights

This commit is contained in:
bunkerity
2021-03-13 15:28:15 +01:00
parent 3591715f21
commit a2543384cd
9 changed files with 16 additions and 13 deletions

View File

@@ -1,12 +1,11 @@
local M = {}
local api_uri = ngx.var.api_uri
local api_list = {}
api_list["^/reload$"] = function ()
return os.execute("/usr/sbin/nginx -s reload") == 0
end
function M.is_api_call ()
function M.is_api_call (api_uri)
if ngx.var.request_uri:sub(1, #api_uri) .. "/" == api_uri .. "/" then
for uri, code in pairs(api_list) do
if string.match(ngx.var.request_uri:sub(#api_uri + 1), uri) then
@@ -17,7 +16,7 @@ function M.is_api_call ()
return false
end
function M.do_api_call ()
function M.do_api_call (api_uri)
for uri, code in pairs(api_list) do
if string.match(ngx.var.request_uri:sub(#api_uri + 1), uri) then
return code()