Skip to content

Instantly share code, notes, and snippets.

@percybolmer
Last active August 6, 2021 11:35
Show Gist options
  • Save percybolmer/1e5b62ab09f497325af9e5fe6d0e1ff6 to your computer and use it in GitHub Desktop.
Save percybolmer/1e5b62ab09f497325af9e5fe6d0e1ff6 to your computer and use it in GitHub Desktop.
// loadTLSCfg will load a certificate and create a tls config
func loadTLSCfg() *tls.Config {
b, _ := ioutil.ReadFile("../cert/server.crt")
cp := x509.NewCertPool()
if !cp.AppendCertsFromPEM(b) {
log.Fatal("credentials: failed to append certificates")
}
config := &tls.Config{
InsecureSkipVerify: false,
RootCAs: cp,
}
return config
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment