Skip to content

Commit eef6d07

Browse files
committed
Merge branch 'has_certificate' of https://github.com/Cargo/lua-resty-auto-ssl into Cargo-has_certificate
2 parents 247f375 + 6958e33 commit eef6d07

File tree

2 files changed

+21
-0
lines changed

2 files changed

+21
-0
lines changed

lib/resty/auto-ssl.lua

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -99,6 +99,11 @@ function _M.challenge_server(self)
9999
server(self)
100100
end
101101

102+
function _M.has_certificate(self, domain)
103+
local has_certificate = require "resty.auto-ssl.utils.has_certificate"
104+
return has_certificate(self, domain)
105+
end
106+
102107
function _M.hook_server(self)
103108
local server = require "resty.auto-ssl.servers.hook"
104109
server(self)
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
return function(auto_ssl_instance, domain, shmem_only)
2+
local shmem = ngx.shared.auto_ssl:get("domain:fullchain_der:" .. domain)
3+
if shmem then
4+
return true
5+
elseif shmem_only then
6+
return false
7+
end
8+
9+
local storage = auto_ssl_instance.storage
10+
local cert = storage:get_cert(domain)
11+
if cert then
12+
return true
13+
end
14+
15+
return false
16+
end

0 commit comments

Comments
 (0)