...
|
...
|
@@ -67,22 +67,23 @@ end |
|
|
|
|
|
local args=ngx.req.get_uri_args()
|
|
|
local method=args["method"]
|
|
|
|
|
|
-- make sure upstream exist
|
|
|
local upstream = args["upstream"]
|
|
|
if upstream == nil or upstream == '' then
|
|
|
ngx.exit(400)
|
|
|
ngx.log(ngx.ERR, "request params is error. upstream is null")
|
|
|
end
|
|
|
|
|
|
if method == "list" then
|
|
|
if not args["upstream"] then
|
|
|
ngx.exit(400)
|
|
|
ngx.log(ngx.ERR, "request params is error. upstream is null")
|
|
|
else
|
|
|
local u_name = args["upstream"]
|
|
|
list(u_name)
|
|
|
end
|
|
|
list(upstream)
|
|
|
elseif(method=="down" or method=="up") then
|
|
|
local upstream=args["upstream"]
|
|
|
local backup=args["backup"]=="true" and true or false
|
|
|
local id=tonumber(args["id"])
|
|
|
local down= method=="down" and true or false
|
|
|
local t={}
|
|
|
ngx.header["Content-type"]="application/json;charset=utf-8"
|
|
|
if (not upstream) or (not id) then
|
|
|
if not id then
|
|
|
ngx.exit(400)
|
|
|
ngx.log(ngx.ERR, "request params is error. upstream or id is null")
|
|
|
else
|
...
|
...
|
|