MCPcopy Create free account
hub / github.com/coder/envbuilder / CABundle

Method CABundle

options/options.go:584–602  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

582}
583
584func (o *Options) CABundle() ([]byte, error) {
585 if o.SSLCertBase64 == "" {
586 return nil, nil
587 }
588
589 certPool, err := x509.SystemCertPool()
590 if err != nil {
591 return nil, fmt.Errorf("get global system cert pool: %w", err)
592 }
593 data, err := base64.StdEncoding.DecodeString(o.SSLCertBase64)
594 if err != nil {
595 return nil, fmt.Errorf("base64 decode ssl cert: %w", err)
596 }
597 ok := certPool.AppendCertsFromPEM(data)
598 if !ok {
599 return nil, fmt.Errorf("failed to append the ssl cert to the global pool: %s", data)
600 }
601 return data, nil
602}
603
604func skipDeprecatedOptions(options []serpent.Option) []serpent.Option {
605 var activeOptions []serpent.Option

Callers 1

CloneOptionsFromOptionsFunction · 0.80

Calls

no outgoing calls

Tested by

no test coverage detected