0
Fork 0
mirror of https://github.com/caddyserver/caddy.git synced 2024-12-23 22:27:38 -05:00

Save obtained certs even if there were failures

This commit is contained in:
Matthew Holt 2015-12-11 15:42:22 -07:00
parent d93fe53e84
commit b0397df719

View file

@ -114,6 +114,19 @@ func Activate(configs []server.Config) ([]server.Config, error) {
errMsg += "[" + domain + "] failed to get certificate: " + obtainErr.Error() + "\n"
}
// Save the certs we did obtain, though, before leaving
if err := saveCertsAndKeys(certificates); err == nil {
if len(certificates) > 0 {
var certList []string
for _, cert := range certificates {
certList = append(certList, cert.Domain)
}
errMsg += "Saved certificates for: " + strings.Join(certList, ", ") + "\n"
}
} else {
errMsg += "Unable to save obtained certificates: " + err.Error() + "\n"
}
return configs, errors.New(errMsg)
}