Last active
August 6, 2021 11:35
-
-
Save percybolmer/1e5b62ab09f497325af9e5fe6d0e1ff6 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// 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