Skip to content

Commit 9e1208e

Browse files
authored
Fix bug
1 parent d1a7547 commit 9e1208e

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

cmd/web_letsencrypt.go

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ package cmd
66

77
import (
88
"net/http"
9+
"strconv"
910
"strings"
1011

1112
"code.gitea.io/gitea/modules/log"
@@ -22,6 +23,11 @@ func runLetsEncrypt(listenAddr, domain, directory, email string, m http.Handler)
2223
// TODO: these are placeholders until we add options for each in settings with appropriate warning
2324
enableHTTPChallenge := true
2425
enableTLSALPNChallenge := true
26+
altHTTPPort := 0
27+
28+
if p, err := strconv.Atoi(setting.PortToRedirect); err == nil {
29+
altHTTPPort = p
30+
}
2531

2632
magic := certmagic.NewDefault()
2733
magic.Storage = &certmagic.FileStorage{Path: directory}
@@ -31,7 +37,7 @@ func runLetsEncrypt(listenAddr, domain, directory, email string, m http.Handler)
3137
DisableHTTPChallenge: !enableHTTPChallenge,
3238
DisableTLSALPNChallenge: !enableTLSALPNChallenge,
3339
ListenHost: listenAddr,
34-
AltHTTPPort: setting.PortToRedirect,
40+
AltHTTPPort: altHTTPPort,
3541
})
3642

3743
magic.Issuers = []certmagic.Issuer{myACME}

0 commit comments

Comments
 (0)