UI - copy from helpers, systemd service and instances page update

This commit is contained in:
bunkerity
2021-07-09 10:27:38 +02:00
parent f771ec43f1
commit 4dd1ff8479
13 changed files with 107 additions and 239 deletions

View File

@@ -1,4 +1,4 @@
local M = {}
local M = {}
local api_list = {}
local iputils = require "resty.iputils"
@@ -10,6 +10,10 @@ api_list["^/reload$"] = function ()
return os.execute("/usr/sbin/nginx -s reload") == 0
end
api_list["^/stop$"] = function ()
return os.execute("/usr/sbin/nginx -s quit") == 0
end
function M.is_api_call (api_uri, api_whitelist_ip)
local whitelist = iputils.parse_cidrs(api_whitelist_ip)
if iputils.ip_in_cidrs(ngx.var.remote_addr, whitelist) and ngx.var.request_uri:sub(1, #api_uri) .. "/" == api_uri .. "/" then