checkmgr/cert.go
func (cm *CheckManager) loadCACert() error {
	if cm.certPool != nil {
		return nil
	}

	cm.certPool = x509.NewCertPool()

	var cert []byte
	var err error

	if cm.enabled {
		// only attempt to retrieve broker CA cert if
		// the check is being managed.
		cert, err = cm.fetchCert()
		if err != nil {
			return err
		}
	}

	if cert == nil {
		cert = circonusCA
	}

	cm.certPool.AppendCertsFromPEM(cert)

	return nil
}
func (cm *CheckManager) loadCACert() error {
	if cm.certPool != nil {
		return nil
	}

	cm.certPool = x509.NewCertPool()

	var cert []byte
	var err error

	if cm.enabled {
		// only attempt to retrieve broker CA cert if
		// the check is being managed.
		cert, err = cm.fetchCert()
		if err != nil {
			return err
		}
	}

	if cert == nil {
		cert = circonusCA
	}

	cm.certPool.AppendCertsFromPEM(cert)

	return nil
}
// loadCACert loads the CA cert for the broker designated by the submission url