Handle CA server startup errors

pull/1751/head
Herman Slatman 2 months ago
parent ec223c1cc2
commit f02d4546a9
No known key found for this signature in database
GPG Key ID: F4D8A44EA0A75A4F

@ -476,6 +476,19 @@ func (ca *CA) Run() error {
// wait till error occurs; ensures the servers keep listening
err := <-errs
// if the error is not the usual HTTP server closed error, it is
// highly likely that an error occurred when starting one of the
// CA servers, possibly because of a port already being in use or
// some part of the configuration not being correct. This case is
// handled by stopping the CA in its entirety.
if !errors.Is(err, http.ErrServerClosed) {
if stopErr := ca.Stop(); stopErr != nil {
err = fmt.Errorf("failed stopping CA after error occurred: %w: %w", err, stopErr)
} else {
err = fmt.Errorf("stopped CA after error occurred: %w", err)
}
}
wg.Wait()
return err

Loading…
Cancel
Save