80
}
81
83
>
if temporalTls == nil || !temporalTls.Enabled {
84
return nil, nil
85
}
87
>
if err != nil {
88
return nil, err
89
}
90
92
>
InsecureSkipVerify: !temporalTls.EnableHostVerification,
93
>
}
94
>
if temporalTls.ServerName != "" {
95
tlsConfig.ServerName = temporalTls.ServerName
96
}
97
98
// Load CA cert
100
>
if err != nil {
101
return nil, err
102
}
105
>
}
106
107
// Load client cert
109
>
if err != nil {
110
return nil, err
111
}
113
tlsConfig.Certificates = []tls.Certificate{*clientCert}
114
}
115
117
}
118
120
>
if temporalTls.CertData != "" && temporalTls.CertFile != "" {
121
return fmt.Errorf("%w: %s", ErrTLSConfig, "only one of certData or certFile properties should be specified")
122
}
123
125
return fmt.Errorf("%w: %s", ErrTLSConfig, "only one of keyData or keyFile properties should be specified")
126
}
127
129
>
keyProvided := temporalTls.KeyData != "" || temporalTls.KeyFile != ""
130
>
if certProvided != keyProvided {
131
return fmt.Errorf("%w: %s", ErrTLSConfig, "cert or key is missing")
132
}
133
135
return fmt.Errorf("%w: %s", ErrTLSConfig, "only one of caData or caFile properties should be specified")
136
}
138
}
139
141
>
var caBytes []byte
142
>
var err error
143
>
if temporalTls.CaFile != "" {
145
>
if err != nil {
146
return nil, fmt.Errorf("%w: %s (%w)", ErrTLSConfig, "unable to read client ca file", err)
147
}