Merge pull request #5277 from ElvinEfendi/small-refactoring
refactoring: use more specific var name
This commit is contained in:
commit
5cf7018b6d
2 changed files with 5 additions and 7 deletions
|
@ -56,13 +56,11 @@ local function get_pem_cert_uid(raw_hostname)
|
|||
end
|
||||
|
||||
function _M.configured_for_current_request()
|
||||
if ngx.ctx.configured_for_current_request ~= nil then
|
||||
return ngx.ctx.configured_for_current_request
|
||||
if ngx.ctx.cert_configured_for_current_request == nil then
|
||||
ngx.ctx.cert_configured_for_current_request = get_pem_cert_uid(ngx.var.host) ~= nil
|
||||
end
|
||||
|
||||
ngx.ctx.configured_for_current_request = get_pem_cert_uid(ngx.var.host) ~= nil
|
||||
|
||||
return ngx.ctx.configured_for_current_request
|
||||
return ngx.ctx.cert_configured_for_current_request
|
||||
end
|
||||
|
||||
function _M.call()
|
||||
|
|
|
@ -135,7 +135,7 @@ describe("Certificate", function()
|
|||
local _ngx = { var = { host = "hostname" } }
|
||||
setmetatable(_ngx, {__index = _G.ngx})
|
||||
_G.ngx = _ngx
|
||||
ngx.ctx.configured_for_current_request = nil
|
||||
ngx.ctx.cert_configured_for_current_request = nil
|
||||
|
||||
set_certificate("hostname", EXAMPLE_CERT, UUID)
|
||||
end)
|
||||
|
@ -150,7 +150,7 @@ describe("Certificate", function()
|
|||
end)
|
||||
|
||||
it("returns cached value from ngx.ctx", function()
|
||||
ngx.ctx.configured_for_current_request = false
|
||||
ngx.ctx.cert_configured_for_current_request = false
|
||||
assert.is_false(certificate.configured_for_current_request())
|
||||
end)
|
||||
end)
|
||||
|
|
Loading…
Reference in a new issue