Applied env package for client cmd

This commit is contained in:
qowevisa 2024-02-25 19:15:05 +02:00
parent 384ac7083f
commit ca3534c5f4

View File

@ -20,10 +20,13 @@ func main() {
log.Fatal(err) log.Fatal(err)
} }
cert, err := os.ReadFile("server.pem") loadingFileName := env.ServerFullchainFileName
cert, err := os.ReadFile(loadingFileName)
if err != nil { if err != nil {
log.Fatalf("client: load root cert: %s", err) log.Fatalf("client: load root cert: %s", err)
} }
log.Printf("Certificate %s loaded successfully!\n", loadingFileName)
//
roots := x509.NewCertPool() roots := x509.NewCertPool()
if ok := roots.AppendCertsFromPEM(cert); !ok { if ok := roots.AppendCertsFromPEM(cert); !ok {
log.Fatalf("client: failed to parse root certificate") log.Fatalf("client: failed to parse root certificate")