1
0

Check a passed listen address first.

This commit is contained in:
Alexander Andreev 2022-12-17 21:35:33 +04:00
parent 760d08dcde
commit b793da40d4
Signed by: Arav
GPG Key ID: 0388CC8FAA51063F

View File

@ -30,11 +30,6 @@ func main() {
return return
} }
hand := handlers.New(directoryPath, web.Assets(), !*enableFileHandler)
srv := server.NewHttpServer()
srv.GET("/*filepath", hand.Index)
var network string var network string
if !strings.ContainsRune(*listenAddress, ':') { if !strings.ContainsRune(*listenAddress, ':') {
network = "unix" network = "unix"
@ -52,6 +47,11 @@ func main() {
} }
} }
hand := handlers.New(directoryPath, web.Assets(), !*enableFileHandler)
srv := server.NewHttpServer()
srv.GET("/*filepath", hand.Index)
if err := srv.Start(network, *listenAddress); err != nil { if err := srv.Start(network, *listenAddress); err != nil {
log.Fatalln(err) log.Fatalln(err)
} }