Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix error message from convert_to_der_and_cache method #300

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 19 additions & 2 deletions 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 @@ -144,7 +153,15 @@ local function get_cert_der(auto_ssl_instance, domain, ssl_options)
if not ssl_options or ssl_options["generate_certs"] ~= false then
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)
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"] = true
return cert_der
end
Expand Down