@@ -58,7 +58,7 @@ func Connect(p ConnectionParams) (*gorm.DB, error) {
5858 if p .CaCert != "" {
5959 rootCertPool := x509 .NewCertPool ()
6060 if ok := rootCertPool .AppendCertsFromPEM ([]byte (p .CaCert )); ! ok {
61- log . Fatal ( "Failed to append custom DB CA cert. " )
61+ return nil , fmt . Errorf ( "failed to append custome certificate for database connection " )
6262 }
6363
6464 tlsConfigName := "custom"
@@ -67,7 +67,7 @@ func Connect(p ConnectionParams) (*gorm.DB, error) {
6767 MinVersion : tls .VersionTLS12 , // semgrep finding: set lower boundary to exclude insecure TLS1.0
6868 })
6969 if err != nil {
70- return nil , fmt .Errorf ("Failed to register custom DB CA cert: %w" , err )
70+ return nil , fmt .Errorf ("failed to register custom DB CA cert: %w" , err )
7171 }
7272 cfg .TLSConfig = tlsConfigName
7373 }
@@ -94,9 +94,9 @@ func Connect(p ConnectionParams) (*gorm.DB, error) {
9494 return nil , fmt .Errorf ("failed to open db connection: %w" , err )
9595 }
9696
97- err = conn .Use (tracing .NewPlugin (tracing . WithoutMetrics () ))
97+ err = conn .Use (tracing .NewPlugin ())
9898 if err != nil {
99- return nil , fmt .Errorf ("failed to setup db tracing: %w" )
99+ return nil , fmt .Errorf ("failed to setup db tracing: %w" , err )
100100 }
101101
102102 return conn , nil
0 commit comments