repo_description: Receive notifications when an image is updated on a Docker registry
repo_topics: automation discord docker golang gotify kubernetes manifest nomad notifications pushover registry rocketchat slack swarm telegram update update-checker watch
code: package utl
  
  import (
  	"crypto/tls"
  	"crypto/x509"
  	"os"
  )
  
  func LoadTLSConfig(insecureSkipVerify bool, caCertFiles []string) (*tls.Config, error) {
  	tlsConfig := &tls.Config{
  		InsecureSkipVerify: insecureSkipVerify,
  	}
  	if len(caCertFiles) > 0 {
  		certPool := x509.NewCertPool()
  		for _, caCertFile := range caCertFiles {
  			caCert, err := os.ReadFile(caCertFile)
  			if err != nil {
  				return nil, err
  			}
  			certPool.AppendCertsFromPEM(caCert)
  		}
  		tlsConfig.RootCAs = certPool
  	}
  	return tlsConfig, nil
  }
  