@@ -58,7 +58,7 @@ func Connect(p ConnectionParams) (*gorm.DB, error) {
58
58
if p .CaCert != "" {
59
59
rootCertPool := x509 .NewCertPool ()
60
60
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 " )
62
62
}
63
63
64
64
tlsConfigName := "custom"
@@ -67,7 +67,7 @@ func Connect(p ConnectionParams) (*gorm.DB, error) {
67
67
MinVersion : tls .VersionTLS12 , // semgrep finding: set lower boundary to exclude insecure TLS1.0
68
68
})
69
69
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 )
71
71
}
72
72
cfg .TLSConfig = tlsConfigName
73
73
}
@@ -94,9 +94,9 @@ func Connect(p ConnectionParams) (*gorm.DB, error) {
94
94
return nil , fmt .Errorf ("failed to open db connection: %w" , err )
95
95
}
96
96
97
- err = conn .Use (tracing .NewPlugin (tracing . WithoutMetrics () ))
97
+ err = conn .Use (tracing .NewPlugin ())
98
98
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 )
100
100
}
101
101
102
102
return conn , nil
0 commit comments