Skip to content

Commit

Permalink
Fix error message from convert_to_der_and_cache method
Browse files Browse the repository at this point in the history
  • Loading branch information
Shivraj0 committed Sep 26, 2024
1 parent 7125960 commit f0d0c6c
Showing 1 changed file with 18 additions and 1 deletion.
19 changes: 18 additions & 1 deletion lib/resty/auto-ssl/ssl_certificate.lua
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,16 @@ local function get_cert_der(auto_ssl_instance, domain, ssl_options)
end

if cert and cert["fullchain_pem"] and cert["privkey_pem"] then
local cert_der = convert_to_der_and_cache(domain, cert)
local cert_der, cert_der_err = convert_to_der_and_cache(domain, cert)

if cert_der_err then
ngx.log(ngx.ERR, "auto-ssl: error converting certificate for ", domain, ": ", cert_der_err)
end

if not cert_der then
return nil, "empty cert_der received"
end

cert_der["newly_issued"] = false
return cert_der
end
Expand All @@ -145,6 +154,14 @@ local function get_cert_der(auto_ssl_instance, domain, ssl_options)
cert = issue_cert(auto_ssl_instance, storage, domain)
if cert and cert["fullchain_pem"] and cert["privkey_pem"] then
local cert_der = convert_to_der_and_cache(domain, cert)
if cert_der_err then
ngx.log(ngx.ERR, "auto-ssl: error converting certificate for ", domain, ": ", cert_der_err)
end

if not cert_der then
return nil, "empty cert_der received"
end

cert_der["newly_issued"] = true
return cert_der
end
Expand Down

0 comments on commit f0d0c6c

Please sign in to comment.