refactor(log): replace panics with log fatal or log panic functions (#1723)

Signed-off-by: Laurentiu Niculae <niculae.laurentiu1@gmail.com>
This commit is contained in:
LaurentiuNiculae
2023-11-24 10:38:36 +02:00
committed by GitHub
parent 83f287d1f6
commit 92837c2bcb
22 changed files with 969 additions and 302 deletions
+6 -2
View File
@@ -192,13 +192,17 @@ func (c *Controller) Run(reloadCtx context.Context) error {
caCert, err := os.ReadFile(c.Config.HTTP.TLS.CACert)
if err != nil {
panic(err)
c.Log.Error().Err(err).Str("caCert", c.Config.HTTP.TLS.CACert).Msg("failed to read file")
return err
}
caCertPool := x509.NewCertPool()
if !caCertPool.AppendCertsFromPEM(caCert) {
panic(errors.ErrBadCACert)
c.Log.Error().Err(errors.ErrBadCACert).Msg("failed to append certs from pem")
return errors.ErrBadCACert
}
server.TLSConfig.ClientAuth = clientAuth