Skip to content

Commit ca36119

Browse files
authored
Merge pull request #128 from lixin9311/fix-self-sign
Fix passing self signed cert via arg/env
2 parents bcd2ce1 + ff8deb0 commit ca36119

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

Diff for: main.go

+4-1
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,10 @@ func readCertificate() ([]byte, error) {
7878
return filesystem.ReadFile(*cert)
7979
}
8080
if *certRaw != "" {
81-
return []byte(*certRaw), nil
81+
certHead := "-----BEGIN CERTIFICATE-----"
82+
certTail := "-----END CERTIFICATE-----"
83+
fixedCert := certHead + "\n" + (*certRaw)[len(certHead):len(*certRaw)-len(certTail)] + "\n" + certTail
84+
return []byte(fixedCert), nil
8285
}
8386
panic("thou shalt not reach hear")
8487
}

0 commit comments

Comments
 (0)