mirror of
https://github.com/kenzok8/small-package
synced 2025-01-08 13:27:36 +08:00
update 2024-10-06 00:23:30
This commit is contained in:
parent
0990234015
commit
6a5ec107df
@ -144,6 +144,9 @@ do
|
|||||||
if true then
|
if true then
|
||||||
local i = 0
|
local i = 0
|
||||||
local option = "lbss"
|
local option = "lbss"
|
||||||
|
local function is_ip_port(str)
|
||||||
|
return str:match("^%d+%.%d+%.%d+%.%d+:%d+$") ~= nil
|
||||||
|
end
|
||||||
uci:foreach(appname, "haproxy_config", function(t)
|
uci:foreach(appname, "haproxy_config", function(t)
|
||||||
i = i + 1
|
i = i + 1
|
||||||
local node_id = t[option]
|
local node_id = t[option]
|
||||||
@ -153,11 +156,17 @@ do
|
|||||||
remarks = "HAProxy负载均衡节点列表[" .. i .. "]",
|
remarks = "HAProxy负载均衡节点列表[" .. i .. "]",
|
||||||
currentNode = node_id and uci:get_all(appname, node_id) or nil,
|
currentNode = node_id and uci:get_all(appname, node_id) or nil,
|
||||||
set = function(o, server)
|
set = function(o, server)
|
||||||
uci:set(appname, t[".name"], option, server)
|
-- 如果当前 lbss 值不是 ip:port 格式,才进行修改
|
||||||
o.newNodeId = server
|
if not is_ip_port(t[option]) then
|
||||||
|
uci:set(appname, t[".name"], option, server)
|
||||||
|
o.newNodeId = server
|
||||||
|
end
|
||||||
end,
|
end,
|
||||||
delete = function(o)
|
delete = function(o)
|
||||||
uci:delete(appname, t[".name"])
|
-- 如果当前 lbss 值不是 ip:port 格式,才进行删除
|
||||||
|
if not is_ip_port(t[option]) then
|
||||||
|
uci:delete(appname, t[".name"])
|
||||||
|
end
|
||||||
end
|
end
|
||||||
}
|
}
|
||||||
end)
|
end)
|
||||||
|
Loading…
Reference in New Issue
Block a user