Skip to content

Commit

Permalink
fix
Browse files Browse the repository at this point in the history
  • Loading branch information
Nithunikzz committed Apr 15, 2024
1 parent 155a06a commit 7c3dafb
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions pkg/mtlsnats/mtlsnats.go
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ func ReadMtlsCerts(certificateFilePath, keyFilePath, CAFilePath string) (certPEM
func OpenMtlsCertFile(filepath string) (f *os.File, err error) {
f, err = os.Open(filepath)
if err != nil {
return nil, fmt.Errorf("Failed to open mtls certificate file: %w", err)
return nil, fmt.Errorf("failed to open mtls certificate file: %w", err)
}
return f, nil
}
Expand All @@ -58,7 +58,7 @@ func ReadMtlsFileContents(filePath string) ([]byte, error) {

contents, err := io.ReadAll(file)
if err != nil {
return nil, fmt.Errorf("Error while reading file %s:%w", filePath, err)
return nil, fmt.Errorf("error while reading file %s:%w", filePath, err)
}

return contents, nil
Expand All @@ -70,19 +70,19 @@ func GetTlsConfig() (*tls.Config, error) {
err := envconfig.Process("", &cfg)

if err != nil {
return nil, fmt.Errorf("Unable to read mtls config %w", err)
return nil, fmt.Errorf("unable to read mtls config %w", err)

}

certPEM, keyPEM, CACertPEM, err := ReadMtlsCerts(cfg.CertificateFilePath, cfg.KeyFilePath, cfg.CAFilePath)
if err != nil {
return nil, fmt.Errorf("Unable to read mtls certificates %w", err)
return nil, fmt.Errorf("unable to read mtls certificates %w", err)

}

cert, err := tls.X509KeyPair(certPEM, keyPEM)
if err != nil {
return nil, fmt.Errorf("Error loading X509 key pair from PEM: %w", err)
return nil, fmt.Errorf("error loading X509 key pair from PEM: %w", err)
}

caCertPool := x509.NewCertPool()
Expand Down

0 comments on commit 7c3dafb

Please sign in to comment.