MCPcopy
hub / github.com/redis/go-redis / loadTLSConfig

Function loadTLSConfig

tls_test.go:16–41  ·  view source on GitHub ↗

loadTLSConfig loads TLS certificates from the docker test environment

(certDir string)

Source from the content-addressed store, hash-verified

14
15// loadTLSConfig loads TLS certificates from the docker test environment
16func loadTLSConfig(certDir string) (*tls.Config, error) {
17 // Load CA cert
18 caCert, err := os.ReadFile(filepath.Join(certDir, "ca.crt"))
19 if err != nil {
20 return nil, err
21 }
22
23 caCertPool := x509.NewCertPool()
24 caCertPool.AppendCertsFromPEM(caCert)
25
26 // Load client cert and key
27 cert, err := tls.LoadX509KeyPair(
28 filepath.Join(certDir, "client.crt"),
29 filepath.Join(certDir, "client.key"),
30 )
31 if err != nil {
32 return nil, err
33 }
34
35 return &tls.Config{
36 RootCAs: caCertPool,
37 Certificates: []tls.Certificate{cert},
38 ServerName: "localhost",
39 InsecureSkipVerify: true,
40 }, nil
41}
42
43var _ = Describe("TLS", Label("NonRedisEnterprise"), func() {
44 var tlsConfig *tls.Config

Callers 1

tls_test.goFile · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected