config 로딩할 때 인증서 오류 무시

This commit is contained in:
2024-07-10 19:37:54 +09:00
parent fa3b0c070a
commit 554bb22f53
2 changed files with 13 additions and 4 deletions

View File

@ -106,20 +106,24 @@ func welcomeHandler(w http.ResponseWriter, r *http.Request) {
w.Write([]byte("welcome"))
}
var tls = flagx.String("tls", "", "")
var tlsflag = flagx.String("tls", "", "")
var portptr = flagx.Int("port", 80, "")
func isTlsEnabled(fileout ...*string) bool {
if len(*tls) == 0 {
if len(*tlsflag) == 0 {
return false
}
crtfile := *tls + ".crt"
if strings.HasSuffix(*tlsflag, "/") {
return false
}
crtfile := *tlsflag + ".crt"
if _, err := os.Stat(crtfile); os.IsNotExist(err) {
return false
}
keyfile := *tls + ".key"
keyfile := *tlsflag + ".key"
if _, err := os.Stat(keyfile); os.IsNotExist(err) {
return false
}