MCPcopy Create free account
hub / github.com/cloudbase/garm / CACertBundle

Method CACertBundle

config/config.go:317–337  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

315}
316
317func (g *Github) CACertBundle() ([]byte, error) {
318 if g.CACertBundlePath == "" {
319 // No CA bundle defined.
320 return nil, nil
321 }
322 if _, err := os.Stat(g.CACertBundlePath); err != nil {
323 return nil, fmt.Errorf("error accessing ca_cert_bundle: %w", err)
324 }
325
326 contents, err := os.ReadFile(g.CACertBundlePath)
327 if err != nil {
328 return nil, fmt.Errorf("reading ca_cert_bundle: %w", err)
329 }
330
331 roots := x509.NewCertPool()
332 if ok := roots.AppendCertsFromPEM(contents); !ok {
333 return nil, fmt.Errorf("failed to parse CA cert bundle")
334 }
335
336 return contents, nil
337}
338
339func (g *Github) UploadEndpoint() string {
340 if g.UploadBaseURL == "" {

Callers 5

TestCACertBundleFunction · 0.95
HTTPClientMethod · 0.95

Calls

no outgoing calls

Tested by 3

TestCACertBundleFunction · 0.76