MCPcopy Index your code
hub / github.com/coder/envbox / addCert

Function addCert

xhttp/client.go:76–89  ·  view source on GitHub ↗
(log slog.Logger, pool *x509.CertPool, path string)

Source from the content-addressed store, hash-verified

74}
75
76func addCert(log slog.Logger, pool *x509.CertPool, path string) error {
77 b, err := os.ReadFile(path)
78 if err != nil {
79 return xerrors.Errorf("read file: %w", err)
80 }
81
82 if !pool.AppendCertsFromPEM(b) {
83 log.Error(context.Background(), "failed to append cert",
84 slog.F("filepath", path))
85 } else {
86 log.Debug(context.Background(), "added cert", slog.F("path", path))
87 }
88 return nil
89}

Callers 1

certPoolFunction · 0.85

Calls 2

ErrorfMethod · 0.65
ErrorMethod · 0.65

Tested by

no test coverage detected