config for scheme and subrouter

This commit is contained in:
simonzhangsz committed 2023-08-29 10:53:43 +08:00
1 parent 5550bb996d
commit 589577b718
4 files changed
+21 -11

No files matched your search

+3 -3
View File
@@ -173,7 +173,7 @@ func main() {
// ipv4 goroutines
if rest.IPv4 != "" {
listen := rest.IPv4 + ":" + strconv.Itoa(int(rest.Port))
if strings.ToLower(rest.Schema) == "https" {
if strings.ToLower(rest.Scheme) == "https" {
go HttpListenTLS(listen, rest.CertFile, rest.KeyFile, router)
} else {
go HttpListen(listen, router)
@@ -183,7 +183,7 @@ func main() {
// ipv6 goroutines
if rest.IPv6 != "" {
listenv6 := "[" + rest.IPv6 + "]" + ":" + strconv.Itoa(int(rest.Port))
if strings.ToLower(rest.Schema) == "https" {
if strings.ToLower(rest.Scheme) == "https" {
go HttpListenTLS(listenv6, rest.CertFile, rest.KeyFile, router)
} else {
go HttpListen(listenv6, router)
@@ -195,7 +195,7 @@ func main() {
fs := http.FileServer(http.Dir(conf.WebServer.RootDir))
http.Handle("/", fs)
for _, listen := range conf.WebServer.Listen {
if strings.ToLower(listen.Schema) == "https" {
if strings.ToLower(listen.Scheme) == "https" {
go HttpListenWebServerTLS(listen.Addr, listen.CertFile, listen.KeyFile)
} else {
go HttpListenWebServer(listen.Addr)