import (
"net/http"
+ "strconv"
"strings"
"code.gitea.io/gitea/modules/log"
// TODO: these are placeholders until we add options for each in settings with appropriate warning
enableHTTPChallenge := true
enableTLSALPNChallenge := true
+ altHTTPPort := 0
+
+ if p, err := strconv.Atoi(setting.PortToRedirect); err == nil {
+ altHTTPPort = p
+ }
magic := certmagic.NewDefault()
magic.Storage = &certmagic.FileStorage{Path: directory}
Agreed: setting.LetsEncryptTOS,
DisableHTTPChallenge: !enableHTTPChallenge,
DisableTLSALPNChallenge: !enableTLSALPNChallenge,
+ ListenHost: listenAddr,
+ AltHTTPPort: altHTTPPort,
})
magic.Issuers = []certmagic.Issuer{myACME}