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:
parent
d93fe53e84
commit
b0397df719
1 changed files with 13 additions and 0 deletions
|
@ -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)
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue