File tree Expand file tree Collapse file tree 1 file changed +16
-1
lines changed Expand file tree Collapse file tree 1 file changed +16
-1
lines changed Original file line number Diff line number Diff line change @@ -47,6 +47,22 @@ var mariadbTemplates = []string{
47
47
"mariadb/default/tls-config.yaml.tmpl" ,
48
48
}
49
49
50
+ // tLSClientConfig creates and returns a TLS client configuration that includes
51
+ // a set of custom CA certificates for secure communication. It reads CA
52
+ // certificates from the environment variable `SSL_CERT_FILE` if it is set,
53
+ // and appends any additional certificates passed as input.
54
+ //
55
+ // Parameters:
56
+ //
57
+ // pems [][]byte: PEM-encoded certificates to be appended to the
58
+ // root certificate pool.
59
+ //
60
+ // Returns:
61
+ //
62
+ // *cryptoTls.Config: A TLS configuration with the certificates set to the updated
63
+ // certificate pool.
64
+ // error: An error if there is a failure in parsing any of the provided PEM
65
+ // certificates, or nil if successful.
50
66
func tLSClientConfig (pems [][]byte ) (* cryptoTls.Config , error ) {
51
67
rootCertPool := x509 .NewCertPool ()
52
68
@@ -120,7 +136,6 @@ var ConnectAndQueryDatabase = func(
120
136
// don't set anything
121
137
case "true" :
122
138
var err error
123
- // if pemCerts is empty, that is OK, we still add OS certs to the tls config
124
139
tlsConfig , err = tLSClientConfig (pemCerts )
125
140
if err != nil {
126
141
log .Info (fmt .Sprintf ("Encountered error when processing custom ca bundle, Error: %v" , err ))
You can’t perform that action at this time.
0 commit comments